[jsword-devel] Bug fixes

DM Smith dmsmith555 at yahoo.com
Sun Jan 22 19:00:04 MST 2006


I have just fixed a few bugs in search.
1) Advanced Search "Something like this spelling" and "Includes words 
starting with" were producing queries with the meta characters in the 
wrong places.
2) Range specifications were picky. If they did not start with a + or a 
- they did not work. If they were not followed by at least one space 
then they didn't work either.
3) A range without anything following produced an error. Not it returns 
an empty search result.

In fixing these bugs, I did a little more abstracting, I moved the 
general purpose query classes out of o.c.j.book.search.lucene into a new 
package o.c.j.book.query for interfaces and factories and 
o.c.j.book.query.basic implementation. I also created a QueryBuilder 
interface based on the o.c.j.book.search.lucene.QueryBuilder (which I 
renamed LuceneQueryBuilder) but the tokenize method was changed to parse 
and rather than returning a list of Query objects it returns a single 
Query. I also created a NullQuery, whose find method returns an empty 
Key. This was so that parse(string) would return something on empty 
input. This replaced the empty array that was returned.

And I made QueryBuilder pluggable with a QueryBuilderFactory.

I renamed SearchSyntax to QueryDecorator, since all the methods were 
decorateThis and decorateThat. And they were constructing a Query.

In fixing the bugs, I noticed that the search mechanism was kind of 
dumb. It would do work when it did not have to. Now it detects at least 
some of these cases and returns early.





More information about the jsword-devel mailing list