Package org.apache.lucene.document

Examples of org.apache.lucene.document.MapFieldSelector


   * @throws IOException
   */
  private String forceClassNameExtraction(int scoreDocIndex) throws IOException {
    Map<String, FieldSelectorResult> fields = new HashMap<String, FieldSelectorResult>( 1 );
    fields.put( DocumentBuilder.CLASS_FIELDNAME, FieldSelectorResult.LOAD_AND_BREAK );
    MapFieldSelector classOnly = new MapFieldSelector( fields );
    Document doc = queryHits.doc( scoreDocIndex, classOnly );
    return doc.get( DocumentBuilder.CLASS_FIELDNAME );
  }
View Full Code Here


   */
  public ESRI_ItemInformation makeItemInfoByUuid(RequestContext context, String[] fields,
      String uuid) throws CorruptIndexException, IOException {
    TermDocs termDocs = null;
    IndexReader reader = null;
    MapFieldSelector selector = null;
    try {
      uuid = Val.chkStr(uuid);
      if (uuid.length() > 0) {
        IndexSearcher srch = this.getSearcher(context);
        reader = srch.getIndexReader();
        if (fields != null) {
          selector = new MapFieldSelector(fields);
        }
        termDocs = reader.termDocs();
        termDocs.seek(new Term(Storeables.FIELD_UUID, uuid));
        if (termDocs.next()) {
          Document document = reader.document(termDocs.doc(), selector);
View Full Code Here

    try {
      uuid = Val.chkStr(uuid);
      if (uuid.length() > 0) {
        IndexSearcher searcher = this.getSearcher(context);
        IndexReader reader = searcher.getIndexReader();
        MapFieldSelector selector = new MapFieldSelector(new String[]{fieldName});
        termDocs = reader.termDocs();
        termDocs.seek(new Term(Storeables.FIELD_UUID,uuid));
        if (termDocs.next()) {
          Document document = reader.document(termDocs.doc(),selector);
          return document.getValues(fieldName);
View Full Code Here

     
      ArrayList<String> alFields = new ArrayList<String>();
      alFields.add(fldModified);
      if (bCheckAcl) alFields.add(fldAcl);
      if (useCollections) alFields.add("isPartOf");
      FieldSelector selector = new MapFieldSelector(alFields.toArray(new String[0]));
     
      Term termUuid = new Term(fldUuid);
      if (bCheckIndex) {
        termDocs = this.reader.termDocs();
      }
View Full Code Here

    try {
      uuid = Val.chkStr(uuid);
      if (uuid.length() > 0) {
        searcher = newSearcher();
        String[] aFields = new String[]{Storeables.FIELD_ACL};
        MapFieldSelector selector = new MapFieldSelector(aFields);
        searcher = newSearcher();
        IndexReader reader = searcher.getIndexReader();
        termDocs = reader.termDocs();
        termDocs.seek(new Term(Storeables.FIELD_UUID,uuid));
        if (termDocs.next()) {
View Full Code Here

    TermDocs termDocs = null;
    try {
      uuid = Val.chkStr(uuid);
      if (uuid.length() > 0) {
        String[] aFields = new String[]{Storeables.FIELD_DATEMODIFIED};
        MapFieldSelector selector = new MapFieldSelector(aFields);
        searcher = newSearcher();
        IndexReader reader = searcher.getIndexReader();
        termDocs = reader.termDocs();
        termDocs.seek(new Term(Storeables.FIELD_UUID,uuid));
        if (termDocs.next()) {
View Full Code Here

    if ( projectionSize != 0 ) {
      for ( String projectedField : projection ) {
        fields.put( projectedField, FieldSelectorResult.LOAD );
      }
    }
    this.fieldSelector = new MapFieldSelector( fields );
  }
View Full Code Here

      // so apply an additional optimization using LOAD_AND_BREAK instead:
      String key = fields.keySet().iterator().next();
      fields.put( key, FieldSelectorResult.LOAD_AND_BREAK );
    }
    if ( fields.size() != 0 ) {
      this.fieldSelector = new MapFieldSelector( fields );
    }
    // else: this.fieldSelector = null; //We need no fields at all
  }
View Full Code Here

   * @throws IOException
   */
  private String forceClassNameExtraction(int scoreDocIndex) throws IOException {
    Map<String, FieldSelectorResult> fields = new HashMap<String, FieldSelectorResult>( 1 );
    fields.put( ProjectionConstants.OBJECT_CLASS, FieldSelectorResult.LOAD_AND_BREAK );
    MapFieldSelector classOnly = new MapFieldSelector( fields );
    Document doc = queryHits.doc( scoreDocIndex, classOnly );
    return doc.get( ProjectionConstants.OBJECT_CLASS );
  }
View Full Code Here

    return fragments.toArray( new String[fragments.size()] );
  }
 
  @Deprecated
  protected String[] getFieldValues( IndexReader reader, int docId, String fieldName) throws IOException {
    Document doc = reader.document( docId, new MapFieldSelector( new String[]{ fieldName } ) );
    return doc.getValues( fieldName ); // according to Document class javadoc, this never returns null
  }
View Full Code Here

TOP

Related Classes of org.apache.lucene.document.MapFieldSelector

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.