Lucene.NET is a source code, class-per-class, API-per-API, algorithmic port of the Java Lucene search engine to the C# and .NET platform utilizing the Microsoft .NET Framework and .NET Standard. NOTE: You should almost always include the [lucene] tag when using this one. The Lucene.NET design is similar to its Java counterpart and you are more likely to get a satisfactory answer when it is included.
Questions tagged [lucene.net]
1845 questions
8
votes
1 answer
TermQuery not returning on a known search term, but WildcardQuery does
Am hoping someone with enough insight into the inner workings of Lucene might be able to point me in the right direction =)
I'll skip most of the surrounding irellevant code, and cut right to the chase. I have a Lucene index, to which I am adding…

Mark Cassidy
- 5,829
- 1
- 22
- 33
8
votes
1 answer
How to order search results by relevance and another field in Lucene.net
I have a requirement to sort search results by relevance and another field.
I need to do something similar to this:
using Lucene.Net.Search;
SortField[] fields = new[] { SortField.SCORE, new SortField("customField") };
Sort sort = new…

Arnold Zokas
- 8,306
- 6
- 50
- 76
8
votes
1 answer
Sitecore Search Predicate Builder multiple keyword search with boosting not working as desired
I have sitecore pages / lucene documents with the following fields:
Title
Filename
Content
File Contents
I'm creating a search for these and have the following requirements:
Hits containing the whole phrase in the title field should be returned…

David Masters
- 8,069
- 2
- 44
- 75
8
votes
2 answers
lucene wildcard query with space
I have Lucene index which has city names.
Consider I want to search for 'New Delhi'. I have string 'New Del' which I want to pass to Lucene searcher and I am expecting output as 'New Delhi'.
If I generate query like Name:New Del* It will give me all…

Ashishkumar Chougule
- 121
- 1
- 1
- 3
8
votes
1 answer
Lucene.NET 2.9 and BitArray/DocIdSet
I found a great example on grabbing facet counts on a base query. It stores the bitarray of the base query to improve the performance each time the a facet gets counted.
var genreQuery = new TermQuery(new Term("genre", genre));
var…

Paul Knopf
- 9,568
- 23
- 77
- 142
8
votes
1 answer
Why does Lucene.NET cause OutOfMemoryException when indexing large files?
I have added the code mention above for IndexWriter.
I have set
writer.SetRAMBufferSizeMB(32);
writer.MergeFactor = 1000;
writer.SetMaxFieldLength(Int32.MaxValue);
writer.UseCompoundFile = false;
all the property for avoiding…

Sanket Thakkar
- 725
- 8
- 18
8
votes
2 answers
Elasticsearch or Lucene
I understood Elasticsearch is built around Lucene but I cannot understand exactly what is the added value of Elasticsearch.
I would like to add a 'Global search' box in my asp.net mvc app, I wonder if I have to use Elasticearch or directly…

bAN
- 13,375
- 16
- 60
- 93
8
votes
3 answers
Do documents in Lucene have to contain the same fields?
I'm considering / working on implementing a search engine for our company's various content types, and am attempting to wrap my head around Lucene (specifically the .net flavor).
For the moment, my primary question is whether or not documents one…

Matt
- 631
- 1
- 7
- 13
8
votes
4 answers
Lucene.NET "OR"
How do I do an "OR" in Lucene.NET. Basically what I have is an array of IDs and I want to return any records where a particular field contains any of the values. I previously was doing this with just one value, but now I want to convert the…

Kyle
- 4,261
- 11
- 46
- 85
8
votes
2 answers
Escaping special characters in wildcard search using Lucene.NET
I have looked for a long time for escaping special characters like #, {, , [, ], ... while in wildcard search in Lucene.NET 3.0.3.0, but I can´t find any possible solutions.
I have index my documents using StandardAnalyzer. The field "title" has the…
user1723639
8
votes
0 answers
How to do sorting in Lucene.Net faceted search
Currently I am doing Faceted search on indexes created by Lucene.NET.
Below is my code.
var query = new MatchAllDocsQuery();
var factedSearch = new SimpleFacetedSearch(luceneIndexReader,new[] { "field1","field2" });
SimpleFacetedSearch.Hits…

Bishwaranjan
- 81
- 2
8
votes
2 answers
How to Index & search the Datetime field in Lucene.NET?
I don't know how to index and Search the Registred_Date(It contains sql format datetime).I need to search between years or days.where i'm using boolean query for the search.The code below is used for numeric field and ordinary field indexing.
…

Dinesh_Dini
- 419
- 8
- 20
8
votes
1 answer
Lucene query fails with mixed MUST/MUST_NOT
Given a document with this text, indexed in a field named Content:
The dish ran away with the spoon.
The following query fails to match that document:
+Content:dish +(-Content:xyz) <-- no results!
I want the query to be treated as must include…

Keith
- 20,636
- 11
- 84
- 125
7
votes
5 answers
Finding exact match using Lucene search API
I'm working on a company search API using Lucene.
My Lucene company index has got 2 companies:
1.Abigail Adams National Bancorp, Inc.
2.National Bancorp
If the user types in National Bancorp, then only company # 2(ie. National Bancorp) should be…

Steve Chapman
- 1,317
- 4
- 23
- 34
7
votes
1 answer
Options for Lucene.NET clustering?
I am interested in running Lucene.NET for an application that runs in Windows clusters. The search problem itself is reasonably small, but the stateless/cluster problem still has to be handled.
I understand that SOLR handles my scenario (and more)…

Fredrik Häll
- 71
- 2