Lucene search (How to query?) - lucene

I am trying to use Lucene full text search. And I cannot understand how to index/search using word forms. First of all I do not wanna to write all by my self. If I use StandardAnalyzer with QueryParser I can find the text like:
some testing text
by queries like "test~", "testing", but it is not works if I try to find it by query like "tested".
So please tell me how to make it right;)))
Thank you for any advice!!!

Make sure you use luke for testing queries etc:
http://www.getopt.org/luke/
It will rewrite and decomponse your query so you can debug the situation.

Related

django 1.10 postgres full text search is not working

I am trying to integrate full text search for django 1.10 with postgres database.
I am following tutorial from
https://docs.djangoproject.com/en/1.10/ref/contrib/postgres/search/
class Question(models.Model):
text = models.TextField(max_length=500)
ans = models.TextField(max_length=1500, blank=True)
I have several questions in the database which has the text 'for' in its text field for example: one question is:
text: what is best for me?
ans: this is best for you.
I am trying to make a query like
q = Question.objects.filter(text__search='for')
But this query is not returning any result. can anyone suggest me why?
It is actually my mistake. For Full text search when Postgres creates index it by default ignore common words like 'the', 'for', 'are','is' etc. So If you try to search using this keywords you search query will return empty even if there are lots of sentences with these words.
I did not know this. So I thought I misconfigured.

Elasticsearch search analyzer

I am playing with indexing an articlenumber in Elasticsearch.
Here i provide a working example:
https://found.no/play/gist/557202b3542be157d813
i dont understand why i get a different score if i change the value for "product_number.search"
if i change the value from "ak454" to "ak 454" the score changes.
i thought that if i am using a search_analyzer the value "ak 454" will be transformed to "ak454" (its mapped using the searchable_id).
you can also look at the analyses tab to see my tokenizer:
https://found.no/play/gist/557202b3542be157d813#analysis
thanks.
The term-query (and filter) does not do any text analysis.
The match-query does, and can achieve what you want.
I adapted the example: https://found.no/play/gist/2de967d844c5fbc14d2f
Setting explain to true is very useful when working with problems like this, as you see exactly what Lucene is doing when it's scoring.

Lotus Domino database FTSearch method and brackets

I need to search with FTSearch something like this - MS004790(419411/10). But it thorws NotesException: Notes error: Query is not understandable (MS004790(419411/10))
So maybe there is some trick to search strings like that or maybe I need to parse it somehow?
Tnx for help!
TL;DR: Wrap your search in quotes.
Full Text search has two modes. Web Search and Notes Search. In your notes preferences you can set this.
Web search is just like a text search. Notes search attempts to parse the search term.
However the client can fall back to Notes search terms if it sees the first characters are capitals (or capital reserved keywords like "FIELD"). So to prevent it from parsing you need to wrap it in quotes.
For example
(LotusScript)
searchString = |"MS004790(419411/10)"|
(Java)
searchString = "\"MS004790(419411/10)\""
If it is still failing after that, manually try the search in the FT search bar. Once you have that working the code should work the same way.
If it is still failing at that point it may be related to the UNK table. If so see the following:
Lotus Domino: After changing TYPE of a field, Full Text Search won't work for this field

Lucene query parser not parse field as expected

I want to parse a simple query using lucene (3.0.3):
title:(+return +"pink panther")
Just like in the documentation example.
The expected result is:
+title:return +title:"pink panther"
But instead i get:
+title:return +title:"itle return pink panther"
The code is very simple (c#):
Query query =
new QueryParser(
Lucene.Net.Util.Version.LUCENE_30,
"content",
new Lucene.Net.Analysis.Standard.StandardAnalyzer(Lucene.Net.Util.Version.LUCENE_30))
.Parse("title:(+return +\"pink panther\")");
I'm unable to reproduce this. Does this still occur for you?
I'm thinking that it may be some display artifacts from the output window. Is this from the Immediate Window, the Watch Window or a call to Console.WriteLine?
Sorry for the trouble, the issue was a custom-modified Lucene.Net assembly...

Howto search all fields with NHibernate Search?

NHibernate is working fine in my current solution but I would like to do queries that search all fields. How can I do something like
.CreateFullTextQuery<MyObjectGraph>("*", queryText)
.CreateFullTextQuery<MyObjectGraph>("%", queryText)
.CreateFullTextQuery<MyObjectGraph>("*:test")
.CreateFullTextQuery<MyObjectGraph>("%:test")
I tried the above but these do not work. I search for quite some time but cannot find a way to do this.
You have to write:
.CreateFullTextQuery<MyObjectGraph>("Field:{0}", criteria);
For example:
.CreateFullTextQuery<MyObjectGraph>("Name:{0}", "Ramon");