Lucene.Net  3.0.3
Lucene.Net is a .NET port of the Java Lucene Indexing Library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Properties
Classes | Static Public Member Functions | List of all members
WorldNet.Net.SynExpand Class Reference

Expand a query by looking up synonyms for every term. You need to invoke Syns2Index first to build the synonym index. More...

Classes

class  CollectorImpl
 CollectorImpl
 
class  Syns2Index
 From project WordNet.Net.Syns2Index More...
 

Static Public Member Functions

static void Main (String[] args)
 Test driver for synonym expansion. Uses boost factor of 0.9 for illustrative purposes.
 
static Query Expand (String query, Searcher syns, Analyzer a, String field, float boost)
 Perform synonym expansion on a query.
 

Detailed Description

Expand a query by looking up synonyms for every term. You need to invoke Syns2Index first to build the synonym index.

See Also
Syns2Index

Definition at line 38 of file SynExpand.cs.

Member Function Documentation

static Query WorldNet.Net.SynExpand.Expand ( String  query,
Searcher  syns,
Analyzer  a,
String  field,
float  boost 
)
static

Perform synonym expansion on a query.

Parameters
queryusers query that is assumed to not have any "special" query syntax, thus it should be just normal words, so "big dog" makes sense, but a query like "title:foo^1.2" doesn't as this should presumably be passed directly to the default query parser
synsa opened to the Lucene index you previously created with Syns2Index. The searcher is not closed or otherwise altered.
aoptional analyzer used to parse the users query else StandardAnalyzer is used
fieldoptional field name to search in or null if you want the default of "contents"
boostoptional boost applied to synonyms else no boost is applied
Returns
the expanded Query

Definition at line 85 of file SynExpand.cs.

static void WorldNet.Net.SynExpand.Main ( String[]  args)
static

Test driver for synonym expansion. Uses boost factor of 0.9 for illustrative purposes.

If you pass in the query "big dog" then it prints out:

Query: big adult^0.9 bad^0.9 bighearted^0.9 boastful^0.9 boastfully^0.9 bounteous^0.9 bountiful^0.9 braggy^0.9 crowing^0.9 freehanded^0.9 giving^0.9 grown^0.9 grownup^0.9 handsome^0.9 large^0.9 liberal^0.9 magnanimous^0.9 momentous^0.9 openhanded^0.9 prominent^0.9 swelled^0.9 vainglorious^0.9 vauntingly^0.9
dog andiron^0.9 blackguard^0.9 bounder^0.9 cad^0.9 chase^0.9 click^0.9 detent^0.9 dogtooth^0.9 firedog^0.9 frank^0.9 frankfurter^0.9 frump^0.9 heel^0.9 hotdog^0.9 hound^0.9 pawl^0.9 tag^0.9 tail^0.9 track^0.9 trail^0.9 weenie^0.9 wiener^0.9 wienerwurst^0.9

Definition at line 54 of file SynExpand.cs.


The documentation for this class was generated from the following file: