public class ProductSearch3 extends java.lang.Object implements ProductSearchInterface
ProductSearchInterface
that searches products
using the Jakarta-Lucene search engine.Modifier and Type | Class and Description |
---|---|
protected static class |
ProductSearch3.ProductSortProdClass
Comparator class that implements a product sort using product classification,
product code and unit of measure code.
|
protected static class |
ProductSearch3.ProductSortProdCode
Comparator class that implements a product sort using product code and
unit of measure code.
|
protected static class |
ProductSearch3.ProductSortProdDesc
Comparator class that implements a product sort using product description,
product code and unit of measure code.
|
protected static class |
ProductSearch3.ProductSortQtyAvail2
Comparator class that implements a product sort using quanity available 2,
product code and unit of measure code.
|
Modifier and Type | Field and Description |
---|---|
protected static java.lang.String |
cvIndexDir
The search index directory
|
protected static int |
cvMaxHits
Maximum number of hits to process.
|
protected static boolean |
cvPrefixSearch
Flag to indicate if phrase searching is to be used.
|
protected static boolean |
cvRealtimeInfoSet
A flag indicating if realtime pricing and availablity has
been retrieved for the returned list of products.
|
protected static java.util.Comparator<Product> |
cvSearchSort
The comparator to use for sorting search results.
|
protected LuceneSearcher |
ivLucene
A reference to the Lucene search utility helper class.
|
protected java.util.HashMap<java.lang.String,java.util.Date> |
ivTrace
Map to hold trace timing by boundry name
|
private static long |
serialVersionUID
The class' serialization version id.
|
static boolean |
TRACE
Constant which turns on detailed tracing
|
Constructor and Description |
---|
ProductSearch3()
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
java.util.ArrayList<Product> |
getMatchingProducts(FlashServletContext ctx,
java.lang.String searchString,
java.util.ArrayList<java.lang.String[]> searchAttributes)
Returns a list of products that match the given search criteria and are
in the session user's catalog.
|
java.util.ArrayList<Product> |
getMatchingProducts(FlashServletContext ctx,
java.lang.String searchString,
java.util.ArrayList<java.lang.String[]> searchAttributes,
java.lang.String catcat,
int maxhits)
Returns a list of products that match the given search criteria and are
in the given catalog category.
|
java.util.Comparator<Product> |
getSortComparator()
Returns the sort comparator for the configured "Product.Search.3.Sort"
property value.
|
boolean |
isRealtimeInfoSet()
Answers if realtime pricing and availablity has been retrieved for the
returned list of products.
|
protected void |
setRealtimeInfo(FlashServletContext ctx,
java.util.ArrayList<Product> products)
Sets the realtime data for a given set of products
|
private void |
trace(java.lang.String x)
Detailed tracing.
|
private void |
traceEnd(java.lang.String x)
End detailed trace boundry, outputs elapsed time since the start of this
boundry.
|
private void |
traceStart(java.lang.String x)
Start detailed trace boundry.
|
private static final long serialVersionUID
public static final boolean TRACE
protected static final java.lang.String cvIndexDir
protected static final boolean cvPrefixSearch
protected static int cvMaxHits
protected static java.util.Comparator<Product> cvSearchSort
protected static boolean cvRealtimeInfoSet
protected LuceneSearcher ivLucene
protected java.util.HashMap<java.lang.String,java.util.Date> ivTrace
public ProductSearch3()
public java.util.ArrayList<Product> getMatchingProducts(FlashServletContext ctx, java.lang.String searchString, java.util.ArrayList<java.lang.String[]> searchAttributes)
getMatchingProducts
in interface ProductSearchInterface
ctx
- (FlashServletContext) The current servlet context.searchString
- (String) The search criteria.searchAttributes
- (ArrayList) The extended attributes search
criteria, a list of String[]
where element 0 is
attribute code, and 1 is relation.public java.util.ArrayList<Product> getMatchingProducts(FlashServletContext ctx, java.lang.String searchString, java.util.ArrayList<java.lang.String[]> searchAttributes, java.lang.String catcat, int maxhits)
getMatchingProducts
in interface ProductSearchInterface
ctx
- (FlashServletContext) The current servlet context.searchString
- (String) The search criteria.searchAttributes
- (ArrayList) The extended attributes search
criteria, a list of String[]
where element 0 is
attribute code, and 1 is relation.catcat
- (String) The catalog category for the results.maxhits
- (int) The maximum number of matches. A 0 (zero)
indicates no maximum.public java.util.Comparator<Product> getSortComparator()
public boolean isRealtimeInfoSet()
true
if realtime info has been retrieved,
otherwise false
.protected void setRealtimeInfo(FlashServletContext ctx, java.util.ArrayList<Product> products)
ctx
- (FlashServletContext) The current servlet context.products
- (ArrayList) The set products to process.private void trace(java.lang.String x)
x
- (String) Text to add to the trace.private void traceStart(java.lang.String x)
x
- (String) Name of the trace boundry.private void traceEnd(java.lang.String x)
x
- (String) Name of the trace boundry.