Class BasicLuceneIndexer

All Implemented Interfaces:
BusinessObject, BusinessProcessor, LuceneIndexer

public class BasicLuceneIndexer extends BaseLuceneProcessor implements LuceneIndexer
Class responsible for creating the Lucene index for advanced search functionality.
Author:
Jason McWilliams, David Tobey
  • Field Details

    • log

      static org.apache.commons.logging.Log log
    • newIndexSubdirectory

      public static final String newIndexSubdirectory
      See Also:
    • oldIndexSubdirectory

      public static final String oldIndexSubdirectory
      See Also:
    • indexWriter

      private org.apache.lucene.index.IndexWriter indexWriter
    • facetWriter

      private org.apache.lucene.facet.taxonomy.TaxonomyWriter facetWriter
  • Constructor Details

    • BasicLuceneIndexer

      public BasicLuceneIndexer()
  • Method Details

    • reindex

      public Map reindex(Map parameters) throws Exception
      Specified by:
      reindex in interface LuceneIndexer
      Throws:
      Exception
    • initIndexWriter

      public org.apache.lucene.index.IndexWriter initIndexWriter(File indexDir, boolean resetIndex) throws Exception
      Throws:
      Exception
    • initFacetWriter

      public org.apache.lucene.facet.taxonomy.TaxonomyWriter initFacetWriter(File facetIndexDir, boolean resetIndex) throws Exception
      Throws:
      Exception
    • addAllProducts

      public Map addAllProducts(org.apache.lucene.index.IndexWriter writer, org.apache.lucene.facet.index.CategoryDocumentBuilder categoryDocBuilder) throws Exception
      Throws:
      Exception
    • indexProduct

      public org.apache.lucene.document.Document indexProduct(Product product) throws Exception
      Throws:
      Exception
    • addEditProduct

      public Map addEditProduct(int productID, String indexDir) throws Exception
      Specified by:
      addEditProduct in interface LuceneIndexer
      Throws:
      Exception
    • indexProductFacets

      public int indexProductFacets(Product product, org.apache.lucene.document.Document doc, org.apache.lucene.facet.index.CategoryDocumentBuilder categoryDocBuilder) throws Exception
      Throws:
      Exception
    • compileFacetsFromProductSettings

      public List compileFacetsFromProductSettings(Product product)
    • compilePriceRangeFacet

      public org.apache.lucene.facet.taxonomy.CategoryPath compilePriceRangeFacet(Product product)
    • compileFacetFromParentCategories

      public org.apache.lucene.facet.taxonomy.CategoryPath compileFacetFromParentCategories(Product product)
    • compileFacetFromManufacturer

      public org.apache.lucene.facet.taxonomy.CategoryPath compileFacetFromManufacturer(Product product)
    • compileFacetFromProductReviews

      public org.apache.lucene.facet.taxonomy.CategoryPath compileFacetFromProductReviews(Product product)
    • compileFacetsFromAttributes

      public Collection compileFacetsFromAttributes(Product product)
    • compileCustomFacets

      public List compileCustomFacets(Product product)
    • addAllCategories

      public Map addAllCategories(org.apache.lucene.index.IndexWriter writer) throws Exception
      Throws:
      Exception
    • indexCategory

      public org.apache.lucene.document.Document indexCategory(Category category) throws Exception
      Throws:
      Exception
    • addEditCategory

      public Map addEditCategory(int categoryID, String indexDir) throws Exception
      Specified by:
      addEditCategory in interface LuceneIndexer
      Throws:
      Exception
    • addAllManufacturers

      public Map addAllManufacturers(org.apache.lucene.index.IndexWriter writer) throws Exception
      Throws:
      Exception
    • indexManufacturer

      public org.apache.lucene.document.Document indexManufacturer(Manufacturer manufacturer) throws Exception
      Throws:
      Exception
    • addEditManufacturer

      public Map addEditManufacturer(int manufacturerID, String indexDir) throws Exception
      Specified by:
      addEditManufacturer in interface LuceneIndexer
      Throws:
      Exception
    • addStringFields

      public void addStringFields(org.apache.lucene.document.Document doc, Object object, StringBuffer contentBuffer) throws Exception
      Specified by:
      addStringFields in interface LuceneIndexer
      Throws:
      Exception
    • addStringFields

      public void addStringFields(org.apache.lucene.document.Document doc, Object object, StringBuffer contentBuffer, String[] fieldsToIndex) throws Exception
      Specified by:
      addStringFields in interface LuceneIndexer
      Throws:
      Exception
    • getTermHitCount

      public int getTermHitCount(String fieldName, String searchString) throws Exception
      Throws:
      Exception