/** * return the best fragment. * * @param fieldQuery FieldQuery object * @param reader IndexReader of the index * @param docId document id to be highlighted * @param fieldName field of the document to be highlighted * @param fragCharSize the length (number of chars) of a fragment * @return the best fragment (snippet) string * @throws IOException */ public final String getBestFragment( final FieldQuery fieldQuery, IndexReader reader, int docId, String fieldName, int fragCharSize ) throws IOException { FieldFragList fieldFragList = getFieldFragList( fieldQuery, reader, docId, fieldName, fragCharSize ); return fragmentsBuilder.createFragment( reader, docId, fieldName, fieldFragList ); }
/** * return the best fragment. * * @param fieldQuery {@link FieldQuery} object * @param reader {@link IndexReader} of the index * @param docId document id to be highlighted * @param fieldName field of the document to be highlighted * @param fragCharSize the length (number of chars) of a fragment * @return the best fragment (snippet) string * @throws IOException If there is a low-level I/O error */ public final String getBestFragment( final FieldQuery fieldQuery, IndexReader reader, int docId, String fieldName, int fragCharSize ) throws IOException { FieldFragList fieldFragList = getFieldFragList( fragListBuilder, fieldQuery, reader, docId, fieldName, fragCharSize ); return fragmentsBuilder.createFragment( reader, docId, fieldName, fieldFragList ); }
/** * return the best fragments. * * @param fieldQuery FieldQuery object * @param reader IndexReader of the index * @param docId document id to be highlighted * @param fieldName field of the document to be highlighted * @param fragCharSize the length (number of chars) of a fragment * @param maxNumFragments maximum number of fragments * @return created fragments or null when no fragments created. * size of the array can be less than maxNumFragments * @throws IOException */ public final String[] getBestFragments( final FieldQuery fieldQuery, IndexReader reader, int docId, String fieldName, int fragCharSize, int maxNumFragments ) throws IOException { FieldFragList fieldFragList = getFieldFragList( fieldQuery, reader, docId, fieldName, fragCharSize ); return fragmentsBuilder.createFragments( reader, docId, fieldName, fieldFragList, maxNumFragments ); }
/** * return the best fragments. * * @param fieldQuery {@link FieldQuery} object * @param reader {@link IndexReader} of the index * @param docId document id to be highlighted * @param fieldName field of the document to be highlighted * @param fragCharSize the length (number of chars) of a fragment * @param maxNumFragments maximum number of fragments * @return created fragments or null when no fragments created. * size of the array can be less than maxNumFragments * @throws IOException If there is a low-level I/O error */ public final String[] getBestFragments( final FieldQuery fieldQuery, IndexReader reader, int docId, String fieldName, int fragCharSize, int maxNumFragments ) throws IOException { FieldFragList fieldFragList = getFieldFragList( fragListBuilder, fieldQuery, reader, docId, fieldName, fragCharSize ); return fragmentsBuilder.createFragments( reader, docId, fieldName, fieldFragList, maxNumFragments ); }
/** * return the best fragment. * * @param fieldQuery {@link FieldQuery} object * @param reader {@link IndexReader} of the index * @param docId document id to be highlighted * @param fieldName field of the document to be highlighted * @param fragCharSize the length (number of chars) of a fragment * @param fragListBuilder {@link FragListBuilder} object * @param fragmentsBuilder {@link FragmentsBuilder} object * @param preTags pre-tags to be used to highlight terms * @param postTags post-tags to be used to highlight terms * @param encoder an encoder that generates encoded text * @return the best fragment (snippet) string * @throws IOException If there is a low-level I/O error */ public final String getBestFragment( final FieldQuery fieldQuery, IndexReader reader, int docId, String fieldName, int fragCharSize, FragListBuilder fragListBuilder, FragmentsBuilder fragmentsBuilder, String[] preTags, String[] postTags, Encoder encoder ) throws IOException { FieldFragList fieldFragList = getFieldFragList( fragListBuilder, fieldQuery, reader, docId, fieldName, fragCharSize ); return fragmentsBuilder.createFragment( reader, docId, fieldName, fieldFragList, preTags, postTags, encoder ); }
/** * return the best fragments. * * @param fieldQuery {@link FieldQuery} object * @param reader {@link IndexReader} of the index * @param docId document id to be highlighted * @param fieldName field of the document to be highlighted * @param fragCharSize the length (number of chars) of a fragment * @param maxNumFragments maximum number of fragments * @param fragListBuilder {@link FragListBuilder} object * @param fragmentsBuilder {@link FragmentsBuilder} object * @param preTags pre-tags to be used to highlight terms * @param postTags post-tags to be used to highlight terms * @param encoder an encoder that generates encoded text * @return created fragments or null when no fragments created. * size of the array can be less than maxNumFragments * @throws IOException If there is a low-level I/O error */ public final String[] getBestFragments( final FieldQuery fieldQuery, IndexReader reader, int docId, String fieldName, int fragCharSize, int maxNumFragments, FragListBuilder fragListBuilder, FragmentsBuilder fragmentsBuilder, String[] preTags, String[] postTags, Encoder encoder ) throws IOException { FieldFragList fieldFragList = getFieldFragList( fragListBuilder, fieldQuery, reader, docId, fieldName, fragCharSize ); return fragmentsBuilder.createFragments( reader, docId, fieldName, fieldFragList, maxNumFragments, preTags, postTags, encoder ); }
String[] preTags, String[] postTags, Encoder encoder ) throws IOException { FieldFragList fieldFragList = getFieldFragList( fragListBuilder, fieldQuery, reader, docId, matchedFields, fragCharSize ); return fragmentsBuilder.createFragments( reader, docId, storedField, fieldFragList, maxNumFragments, preTags, postTags, encoder );