public class ProductIndexSearch<P extends Product> extends com.neurosys.spider.indexer.service.AbstractIndexSearch<P> implements com.neurosys.spider.indexer.service.CategoryIndexSearch<P,IHierarchialReference>
Product
Constructor and Description |
---|
ProductIndexSearch() |
Modifier and Type | Method and Description |
---|---|
protected Page<P> |
_search(PageInfo pageInfo,
com.neurosys.spider.domain.SearchParams searchParams,
org.apache.lucene.facet.params.FacetSearchParams facetSearchParams) |
protected List<P> |
_search(com.neurosys.spider.domain.SearchParams searchParams,
org.apache.lucene.facet.params.FacetSearchParams facetSearchParams) |
protected int |
_searchResultSize(com.neurosys.spider.domain.SearchParams searchParams,
org.apache.lucene.facet.params.FacetSearchParams facetSearchParams) |
protected org.apache.lucene.facet.params.FacetSearchParams |
deriveFacetParams(IHierarchialReference... categories)
TODO: Add unit Test case.
|
protected org.apache.lucene.facet.search.FacetRequest |
deriveFacetRequest(IHierarchialReference category)
By default this method will use the
IHierarchialReference.getHierarchy() code
to derive all the paths; hence its important each time any change in Hierarchy a Re-Index is done.
The strategy to create/derive the CategoryPath s should match DefaultHierarchyBasedCategoryBuilder.getCategoryPaths(java.util.List<H>)
TODO: Needs to be reviewed and upgraded |
protected List<P> |
fetchEntities(List<org.apache.lucene.document.Document> docs,
List<com.neurosys.spider.domain.SearchParams.SortParam> sortParams) |
com.neurosys.spider.indexer.DefaultHierarchyBasedCategoryBuilder |
getCategoryBuilder() |
ProductDao<P> |
getDao() |
String[] |
getDocumentFieldsToQuery()
The document fields to query, should be same or a SubSet of the fields specified in the Indexing Query
The name should also match that of the alias specified in the Query (for indexing) |
org.apache.commons.collections.Transformer |
getDocumentToIdTransformer()
For a
Document in an index identify the Id |
QueryOptimizer |
getQueryOptimizer()
Uses a
QueryOptimizer to limit the joins and fields required for hierarchical records |
void |
index() |
Page<P> |
search(PageInfo pageInfo,
com.neurosys.spider.domain.SearchParams searchParams) |
Page<P> |
search(PageInfo pageInfo,
com.neurosys.spider.domain.SearchParams searchParams,
IHierarchialReference... categories) |
List<P> |
search(com.neurosys.spider.domain.SearchParams searchParams) |
List<P> |
search(com.neurosys.spider.domain.SearchParams searchParams,
IHierarchialReference... categories) |
int |
searchResultSize(com.neurosys.spider.domain.SearchParams searchParams) |
int |
searchResultSize(com.neurosys.spider.domain.SearchParams searchParams,
IHierarchialReference... categories) |
void |
setCategoryBuilder(com.neurosys.spider.indexer.DefaultHierarchyBasedCategoryBuilder categoryBuilder) |
void |
setDao(ProductDao<P> dao) |
void |
setDocumentFieldsToQuery(String[] documentFieldsToQuery)
The document fields to query, should be same or a SubSet of the fields specified in the Indexing Query
The name should also match that of the alias specified in the Query (for indexing) |
void |
setDocumentToIdTransformer(org.apache.commons.collections.Transformer documentToIdTransformer)
For a
Document in an index identify the Id |
void |
setQueryOptimizer(QueryOptimizer queryOptimizer)
Uses a
QueryOptimizer to limit the joins and fields required for hierarchical records |
protected com.neurosys.spider.query.TermQueryTemplate |
setupQueryFromContext(com.neurosys.spider.domain.SearchParams searchParams,
org.apache.lucene.facet.params.FacetSearchParams facetSearchParams)
Setup all context params for the
TermQueryTemplate ; into a new instance. |
void |
updateIndex(String sql) |
getAnalyzer, getAnalyzersList, getCurrentWriteIndex, getDbReadProcessor, getTermModifiersMap, getTermQueryTemplate, getWriteSize, prepareQuery, prepareQueryString, prepareSort, prepareTermForQuery, setAnalyzersList, setDbReadProcessor, setTermModifiersMap, setTermQueryTemplate
public void index() throws Exception
protected List<P> fetchEntities(List<org.apache.lucene.document.Document> docs, List<com.neurosys.spider.domain.SearchParams.SortParam> sortParams)
protected com.neurosys.spider.query.TermQueryTemplate setupQueryFromContext(com.neurosys.spider.domain.SearchParams searchParams, org.apache.lucene.facet.params.FacetSearchParams facetSearchParams) throws org.apache.lucene.queryparser.classic.ParseException, IOException
TermQueryTemplate
; into a new instance.
org.apache.lucene.queryparser.classic.ParseException
IOException
@Transactional(readOnly=true) protected final Page<P> _search(PageInfo pageInfo, com.neurosys.spider.domain.SearchParams searchParams, org.apache.lucene.facet.params.FacetSearchParams facetSearchParams) throws org.apache.lucene.queryparser.classic.ParseException, IOException
org.apache.lucene.queryparser.classic.ParseException
IOException
@Transactional(readOnly=true) public Page<P> search(PageInfo pageInfo, com.neurosys.spider.domain.SearchParams searchParams) throws org.apache.lucene.queryparser.classic.ParseException, IOException
search
in interface com.neurosys.spider.indexer.service.IndexSearch<P extends Product>
org.apache.lucene.queryparser.classic.ParseException
IOException
@Transactional(readOnly=true) protected final List<P> _search(com.neurosys.spider.domain.SearchParams searchParams, org.apache.lucene.facet.params.FacetSearchParams facetSearchParams) throws org.apache.lucene.queryparser.classic.ParseException, IOException
org.apache.lucene.queryparser.classic.ParseException
IOException
@Transactional(readOnly=true) public List<P> search(com.neurosys.spider.domain.SearchParams searchParams) throws org.apache.lucene.queryparser.classic.ParseException, IOException
search
in interface com.neurosys.spider.indexer.service.IndexSearch<P extends Product>
org.apache.lucene.queryparser.classic.ParseException
IOException
@Transactional(readOnly=true) protected final int _searchResultSize(com.neurosys.spider.domain.SearchParams searchParams, org.apache.lucene.facet.params.FacetSearchParams facetSearchParams) throws org.apache.lucene.queryparser.classic.ParseException, IOException
org.apache.lucene.queryparser.classic.ParseException
IOException
@Transactional(readOnly=true) public int searchResultSize(com.neurosys.spider.domain.SearchParams searchParams) throws org.apache.lucene.queryparser.classic.ParseException, IOException
searchResultSize
in interface com.neurosys.spider.indexer.service.IndexSearch<P extends Product>
org.apache.lucene.queryparser.classic.ParseException
IOException
protected org.apache.lucene.facet.search.FacetRequest deriveFacetRequest(IHierarchialReference category)
IHierarchialReference.getHierarchy()
code
to derive all the paths; hence its important each time any change in Hierarchy a Re-Index is done.
CategoryPath
s should match DefaultHierarchyBasedCategoryBuilder.getCategoryPaths(java.util.List<H>)
TODO: Needs to be reviewed and upgradedcategory
- as IHierarchialReference
protected org.apache.lucene.facet.params.FacetSearchParams deriveFacetParams(IHierarchialReference... categories)
public Page<P> search(PageInfo pageInfo, com.neurosys.spider.domain.SearchParams searchParams, IHierarchialReference... categories) throws Exception
search
in interface com.neurosys.spider.indexer.service.CategoryIndexSearch<P extends Product,IHierarchialReference>
Exception
public List<P> search(com.neurosys.spider.domain.SearchParams searchParams, IHierarchialReference... categories) throws Exception
search
in interface com.neurosys.spider.indexer.service.CategoryIndexSearch<P extends Product,IHierarchialReference>
Exception
public int searchResultSize(com.neurosys.spider.domain.SearchParams searchParams, IHierarchialReference... categories) throws Exception
searchResultSize
in interface com.neurosys.spider.indexer.service.CategoryIndexSearch<P extends Product,IHierarchialReference>
Exception
public ProductDao<P> getDao()
public void setDao(ProductDao<P> dao)
public String[] getDocumentFieldsToQuery()
public void setDocumentFieldsToQuery(String[] documentFieldsToQuery)
public com.neurosys.spider.indexer.DefaultHierarchyBasedCategoryBuilder getCategoryBuilder()
public void setCategoryBuilder(com.neurosys.spider.indexer.DefaultHierarchyBasedCategoryBuilder categoryBuilder)
public org.apache.commons.collections.Transformer getDocumentToIdTransformer()
Document
in an index identify the IdTransformer
public void setDocumentToIdTransformer(org.apache.commons.collections.Transformer documentToIdTransformer)
Document
in an index identify the IdTransformer
public QueryOptimizer getQueryOptimizer()
QueryOptimizer
to limit the joins and fields required for hierarchical recordspublic void setQueryOptimizer(QueryOptimizer queryOptimizer)
QueryOptimizer
to limit the joins and fields required for hierarchical recordsCopyright © 2018. All rights reserved.