lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ross Rankin" <r...@commercescience.com>
Subject Problems...
Date Tue, 04 Jan 2005 15:53:02 GMT
(Bear with me; I have inherited this system from another developer who is no
longer with the company.  So I am not familiar with Lucene at all.  I just
have got the task of "Fixing the search".)  

 

I have servlet that runs every 10 minutes and indexes and I can see files
being created in the index path on that interval (fdt,fdx,fnm,frq, etc.)
however the search function is no longer working.  I'm not getting anything
in the log that I can point to that says what is not working, the search or
the index.  But since the index files seem to change size/date stamp as they
have in the past, I'm leaning towards the search function.   

 

I'm not sure where or how to troubleshoot.  Can I examine the indexes with
anything to see what is there and that it's meaningful.  Is there something
simple I can do to track down what doesn't work in the process?  Thanks.

 

Ross

 

Here's the search function:

    public Hits search(String searchString, String resellerId) {

        int currentOffset = 0;

        try {

            currentOffset = Integer.parseInt(paramOffset);

        } catch (NumberFormatException e) {}

 

        System.out.println("\n\t\tSearch for " + searchString + " off = " +
currentOffset);

        if (currentOffset > 0) {

            // if the user only requested the next n items from the search
returns

            return hits;

        }

 

        // performs a new search

        try {

            hits = null;

            try {

                searcher.close();

            } catch (Exception e){}

 

            searcher = new IndexSearcher(pathToIndex);

            Analyzer analyzer = new StandardAnalyzer();

 

            String searchQuery = LuceneConstants.FIELD_RESELLER_IDS + ":"

                    + resellerId

                    + " AND "

                    + LuceneConstants.FIELD_FULL_DESCRIPTION + ":" +
searchString;

 

 

            Query query = null;

            try {

                query = QueryParser.parse(searchQuery,

                            LuceneConstants.FIELD_FULL_DESCRIPTION,
analyzer);

            } catch (ParseException e) {

                // if an excepption occures parsing the search string
entered by the user

                // escapes all the special lucene chars and try to make the
query again.

                searchQuery = LuceneConstants.FIELD_RESELLER_IDS + ":"

                    + resellerId + " AND "

                    + LuceneConstants.FIELD_FULL_DESCRIPTION + ":"

                    + escape(searchString);

                query = QueryParser.parse(searchQuery,

                            LuceneConstants.FIELD_FULL_DESCRIPTION,
analyzer);

            }

            System.out.println("Searching for: " +
query.toString(LuceneConstants.FIELD_FULL_DESCRIPTION));

 

            hits = searcher.search(query);

            System.out.println(hits.length() + " total matching documents");

            //searcher.close();

 

        } catch (Exception e) {

            e.printStackTrace();

        }

 

        return hits;


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message