lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Todd McGrath" <mcgr...@supergloo.com>
Subject multi-word/phrase filters
Date Wed, 23 Apr 2003 19:41:24 GMT
Hi,

I'm having trouble with filters that have a Term with more than one word.
I'm using the ChainableFilter contrib and everything is running great when I
filter with a single word.

More info-
Index consists of articles that are associated with particular topics.  So,
topics are stored in the index with a "assocation" Field (along with Fields
for article title, content, etc.)  The "association" Field is a space
separated list of values that indicate what topic(s) the article is
associated. One example list of topics stored in the "assocation" Field is:
topic1 topic2 topic3.   But another assocation Field example list might have
topic names that contain spaces: topic1 topic two topic3 where "topic two"
is a two word topic.

If I filter results, with Filters of "topic1", "topic2", etc. everything
great!  But if I try to filter by "topic two", no results.

Any pointers debugging this is appreciated.  I don't think I'm doing
anything fancy- using StandardAnalyzer and a Filter class with a bits method
that looks like this:

public java.util.BitSet bits(IndexReader reader) throws java.io.IOException
{

	BitSet bits = new BitSet(reader.maxDoc());

	// field will be "association" and text will be "topic1" or "topic two"
	// text is not wrapped in quotes or backslashes, just a String from HTML
form

	Term filterterm = new Term(field, text);

	TermDocs termDocs = reader.termDocs(filterterm);

	if (termDocs == null) {
		return bits;
	}

	try {
	  while (termDocs.next())
	    bits.set(termDocs.doc());
	} finally {
	  termDocs.close();
	}

	return bits;
}

I've tried storing "association" in Field.Text, Keyword and Unstored.


Todd


---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-user-help@jakarta.apache.org


Mime
View raw message