Refine search
@Override public void enhance( Document document ) { document.add( new StringField( LuceneExplicitIndex.KEY_START_NODE_ID, "" + startNode, Store.YES ) ); document.add( new StringField( LuceneExplicitIndex.KEY_END_NODE_ID, "" + endNode, Store.YES ) ); } }
private DocWithId() { idField = new StringField( NODE_ID_KEY, "", YES ); idValueField = new NumericDocValuesField( NODE_ID_KEY, 0L ); document = new Document(); document.add( idField ); document.add( idValueField ); }
private DocWithId() { idField = new StringField( FIELD_ENTITY_ID, "", YES ); idValueField = new NumericDocValuesField( FIELD_ENTITY_ID, 0L ); document = new Document(); document.add( idField ); document.add( idValueField ); }
/** * Add a Apache Geode key to a document */ public static void addKey(Object key, Document doc) { if (key instanceof String) { doc.add(new StringField(KEY_FIELD, (String) key, Store.YES)); } else { doc.add(new StringField(KEY_FIELD, keyToBytes(key), Store.YES)); } }
public static Document newBaseDocument( long entityId ) { Document doc = new Document(); doc.add( new StringField( LuceneExplicitIndex.KEY_DOC_ID, "" + entityId, Store.YES ) ); doc.add( new NumericDocValuesField( LuceneExplicitIndex.KEY_DOC_ID, entityId ) ); return doc; }
@Override protected void addNewFieldToDocument( Document document, String key, Object value ) { document.add( new StringField( exactKey( key ), value.toString(), Store.YES ) ); document.add( instantiateField( key, value, TextField.TYPE_STORED ) ); document.add( instantiateSortField( key, value ) ); }
private void addPatterns(String id, Map<Integer, Set<E>> p, boolean commit) { try{ setIndexWriter(); Document doc = new Document(); doc.add(new StringField("sentid", id, Field.Store.YES)); doc.add(new Field("patterns", getBytes(p), LuceneFieldType.NOT_INDEXED)); indexWriter.addDocument(doc); if(commit){ indexWriter.commit(); //closeIndexWriter(); } }catch(IOException e){ throw new RuntimeException(e); } }
private void addField(final Document doc, final SearchableField field, final String value, final Store store) { if (value == null || (!field.isAttribute() && !searchableEventFields.contains(field))) { return; } doc.add(new StringField(field.getSearchableFieldName(), value.toLowerCase(), store)); }
@Override protected void add(List<CoreLabel> tokens, String sentid, boolean addProcessedText){ try{ setIndexWriter(); Document doc = new Document(); for(CoreLabel l : tokens) { for (Map.Entry<String, String> en: transformCoreLabeltoString.apply(l).entrySet()) { doc.add(new StringField(en.getKey(), en.getValue(), Field.Store.YES));//, ANALYZED)); } if(addProcessedText){ String ptxt = l.get(PatternsAnnotations.ProcessedTextAnnotation.class); if(!stopWords.contains(ptxt.toLowerCase())) doc.add(new StringField(Token.getKeyForClass(PatternsAnnotations.ProcessedTextAnnotation.class), ptxt, Field.Store.YES));//, ANALYZED)); } } doc.add(new StringField("sentid", sentid, Field.Store.YES)); if(tokens!= null && saveTokens) doc.add(new Field("tokens", getProtoBufAnnotation(tokens), LuceneFieldType.NOT_INDEXED)); indexWriter.addDocument(doc); }catch(IOException e){ throw new RuntimeException(e); } }
private void addField(final Document doc, final SearchableField field, final String value) { if (value == null || (!field.isAttribute() && !searchableEventFields.contains(field))) { return; } doc.add(new StringField(field.getSearchableFieldName(), value.toLowerCase(), Store.NO)); }
private void addCluster(IndexWriter iwriter, StopCluster stopCluster) throws IOException { Document doc = new Document(); doc.add(new TextField("name", stopCluster.name, Field.Store.YES)); doc.add(new DoubleField("lat", stopCluster.lat, Field.Store.YES)); doc.add(new DoubleField("lon", stopCluster.lon, Field.Store.YES)); doc.add(new StringField("id", stopCluster.id, Field.Store.YES)); doc.add(new StringField("category", Category.CLUSTER.name(), Field.Store.YES)); iwriter.addDocument(doc); }
document.add( new StoredField( TX_STATE_KEY, TX_STATE_VALUE ) ); cachedDocuments.put( id, document ); add = true; document.add( new StringField( ORPHANS_KEY, ORPHANS_VALUE, Store.NO ) ); addOrphan( null ); document.add( new StringField( ORPHANS_KEY, key, Store.NO ) ); addOrphan( key );
private static void insertRandomDocuments( IndexWriter writer ) throws IOException { Document doc = new Document(); doc.add( new StringField( "a", "b", Field.Store.YES ) ); doc.add( new StringField( "c", "d", Field.Store.NO ) ); writer.addDocument( doc ); writer.commit(); }
DateTools.Resolution.MILLISECOND); path = Util.fixPathIfWindows(path); doc.add(new Field(QueryBuilder.U, Util.path2uid(path, date), string_ft_stored_nanalyzed_norms)); doc.add(new Field(QueryBuilder.FULLPATH, file.getAbsolutePath(), string_ft_nstored_nanalyzed_norms)); doc.add(new SortedDocValuesField(QueryBuilder.FULLPATH, new BytesRef(file.getAbsolutePath()))); if (fileParent != null && fileParent.length() > 0) { String normalizedPath = QueryBuilder.normalizeDirPath(fileParent); StringField npstring = new StringField(QueryBuilder.DIRPATH, normalizedPath, Store.NO); doc.add(npstring); doc.add(new StringField(QueryBuilder.TYPE, type, Store.YES));
private static Document newDocument() { Document doc = new Document(); doc.add( new StringField( "test", UUID.randomUUID().toString(), Field.Store.YES ) ); return doc; } }
private void addKeywordField(Document document, String name, String value) { if (value != null) { document.add(new StringField(name, value, Field.Store.YES)); } }
private static Document randomDocument() { Document doc = new Document(); doc.add( new StringField( "field", RandomStringUtils.randomNumeric( 5 ), Field.Store.YES ) ); return doc; } }
@Override public void addFields(final String name, final Object value, final ViewSettings settings, final Document to) { to.add(boost(new StringField(name, value.toString(), settings.getStore()), settings)); to.add(new SortedDocValuesField(name, new BytesRef(value.toString()))); }
private void addStop(IndexWriter iwriter, Stop stop) throws IOException { Document doc = new Document(); doc.add(new TextField("name", stop.getName(), Field.Store.YES)); if (stop.getCode() != null) { doc.add(new StringField("code", stop.getCode(), Field.Store.YES)); } doc.add(new DoubleField("lat", stop.getLat(), Field.Store.YES)); doc.add(new DoubleField("lon", stop.getLon(), Field.Store.YES)); doc.add(new StringField("id", stop.getId().toString(), Field.Store.YES)); doc.add(new StringField("category", Category.STOP.name(), Field.Store.YES)); iwriter.addDocument(doc); }
@Override public void set(String theName, Object theValue, Document theDocument, LuceneOptions theLuceneOptions) { @SuppressWarnings("unchecked") Collection<TermConceptProperty> properties = (Collection<TermConceptProperty>) theValue; if (properties != null) { for (TermConceptProperty next : properties) { theDocument.add(new StringField(CONCEPT_FIELD_PROPERTY_PREFIX + next.getKey(), next.getValue(), Field.Store.YES)); if (next.getType() == TermConceptPropertyTypeEnum.CODING) { if (isNotBlank(next.getDisplay())) { theDocument.add(new StringField(CONCEPT_FIELD_PROPERTY_PREFIX + next.getKey(), next.getDisplay(), Field.Store.YES)); } } } } } }