public class SearchResultBuilder extends java.lang.Object implements ISearchResultBuilder
Constructor and Description |
---|
SearchResultBuilder(LuceneSearch luceneSearch)
Use this constructor if you do not wish to retrieve highlighted terms found in the best sections of a text.
|
SearchResultBuilder(LuceneSearch luceneSearch,
org.apache.lucene.search.Query query) |
Modifier and Type | Method and Description |
---|---|
java.util.List<DocumentSearchResult> |
createResultSet(org.apache.lucene.search.TopDocs topDocs,
java.lang.String[] highlightFields)
Creates a
List of DocumentSearchResult entities from the supplied TopDocs . |
<T extends CdmBase> |
createResultSet(org.apache.lucene.search.TopDocs topDocs,
java.lang.String[] highlightFields,
ICdmEntityDao<T> dao,
java.util.Map<CdmBaseType,java.lang.String> idFields,
java.util.List<java.lang.String> propertyPaths)
Creates a
List of SearchResult entities from the supplied TopDocs . |
<T extends CdmBase> |
createResultSet(org.apache.lucene.search.grouping.TopGroups<org.apache.lucene.util.BytesRef> topGroupsResultSet,
java.lang.String[] highlightFields,
ICdmEntityDao<T> dao,
java.util.Map<CdmBaseType,java.lang.String> idFields,
java.util.List<java.lang.String> propertyPaths)
Creates a
List of SearchResult entities from the supplied TopDocs . |
public static final Logger logger
public SearchResultBuilder(LuceneSearch luceneSearch)
luceneSearch
- public SearchResultBuilder(LuceneSearch luceneSearch, org.apache.lucene.search.Query query)
luceneSearch
- query
- the Query will be used to highlight matching fragments if the highlightFields
property is supplied to
#createResultSet(TopDocs, String[], ICdmEntityDao, String, List)
public <T extends CdmBase> java.util.List<SearchResult<T>> createResultSet(org.apache.lucene.search.grouping.TopGroups<org.apache.lucene.util.BytesRef> topGroupsResultSet, java.lang.String[] highlightFields, ICdmEntityDao<T> dao, java.util.Map<CdmBaseType,java.lang.String> idFields, java.util.List<java.lang.String> propertyPaths) throws org.apache.lucene.index.CorruptIndexException, java.io.IOException
List
of SearchResult
entities from the supplied TopDocs
.
The firts Cdm enitity id found in the specified idFields
of the Lucene documents will be used to load
the referenced Cdm entities into the SearchResult
s.
MultiTermQuery
like WildcardQuery
are
constant score by default since Lucene 2.9, you can change that back to
scoring mode: WildcardQuery.setRewriteMethod(MultiTermQuery.SCORING_BOOLEAN_QUERY_REWRITE)
This slows down the query immense or throws TooManyClauses exceptions if
too many terms match the wildcard.createResultSet
in interface ISearchResultBuilder
idFields
- a map of class names as key and entity id fields as valuesorg.apache.lucene.index.CorruptIndexException
java.io.IOException
public <T extends CdmBase> java.util.List<SearchResult<T>> createResultSet(org.apache.lucene.search.TopDocs topDocs, java.lang.String[] highlightFields, ICdmEntityDao<T> dao, java.util.Map<CdmBaseType,java.lang.String> idFields, java.util.List<java.lang.String> propertyPaths) throws org.apache.lucene.index.CorruptIndexException, java.io.IOException
List
of SearchResult
entities from the supplied TopDocs
.
The first Cdm enitity id found in the specified idFields
of the Lucene documents will be used to load
the referenced Cdm entities into the SearchResult
s.createResultSet
in interface ISearchResultBuilder
idFields
- a map of class names as key and entity id fields as valuesorg.apache.lucene.index.CorruptIndexException
java.io.IOException
public java.util.List<DocumentSearchResult> createResultSet(org.apache.lucene.search.TopDocs topDocs, java.lang.String[] highlightFields) throws org.apache.lucene.index.CorruptIndexException, java.io.IOException
List
of DocumentSearchResult
entities from the supplied TopDocs
.
This method can be used for building index-only results.createResultSet
in interface ISearchResultBuilder
org.apache.lucene.index.CorruptIndexException
java.io.IOException
Copyright © 2007-2020 EDIT. All Rights Reserved.