Am 29.04.2012 22:07, schrieb Meeraj Kunnumpurath:
> Hi,
>
> I am quite new to Neo4J and have been looking at using full-text
> searches on Nodes using Lucene. I have a few queries around this, some
> are a bit basic, so please excuse my ignorance.
>
> 1. Index Configuration
>
> I specify the index configuration using
> graphDb.index().forNodes("books", MapUtil.stringMap(
> IndexManager.PROVIDER, "lucene", "type", "fulltext" )), when I get the
> index to add a node to the index. Do I need to repeat the configuration,
> when I get the same index later to query it. Or is it sufficient to just
> do graphDb.index().forNodes("books")
IMHO it's sufficient to supply the parameter upon initial index creation.
>
> 2. Multi Attribute Indexes
>
> I am using one index using Lucene on two attributes (name of the book
> and the category). Is there anyway, I can query across the two
> attributes in one query? Currently, I concatenate values of both
> attributes and store them against one key in the index, and search
> against that key.
you can store multiple attribute into the same index:
index.add(node, 'name', <value1>);
index.add(node, 'category', <value2>);
querying can then be done using regular lucene syntax
index.query("name:\"<value1>\" AND body:\"<value2>\"")
>
> 3. Ignoring Common Terms
>
> How do I get Lucene query to ignore common terms in the search text.
> Currently I can get it work with "Tempest" and "Shakespeare", however it
> doesn't fetch anything if I try "Tempest by Shakespeare"
You can supply an 'analyzer' parameter on index creation. See bottom of
http://docs.neo4j.org/chunked/stable/indexing-create-advanced.html.
>
> 4. When any of the searchable attributes change, what is the best way to
> update the index?
Using the autoindexer.
>
> 5. In general, for fulltext and otherwise, is there a way of
> auto-indexing properties?
That's a little bit tricky. Before creation of any autoindex you have to use
graphDb.index().forNodes("node_auto_index", <parameters>) and
graphDb.index().forNodes("relationship_auto_index", <parameters>)
Regards,
Stefan
>
> Regards
> Meeraj