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");
Related
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.
I have a model which contains emails with some other fields.
I want a custom filter in Yii CGridView's advance search which when applied, lists only Invalid Email IDs (using regular expression '^[A-Z0-9._%-]+#[A-Z0-9.-]+\.[A-Z]{2,4}$')
Note: I dont want to add any column in CGridView
I hope to help you out,
you will need several things
the line for filtering in the column of your choice...(i recommend you create a new attribute for this, ask me in comments if you want to know more why.) this goes in the cgridview of course:
'filter'=>CHtml::activeCheckBox($model, $attributeEmail)
the condition in your search of function that brings up the model.
Supposing you have a criteria inside your search in your model wich help you with your filtering what you need is ...
if($this->EMAIL == TRUE)
{
$criteria->addCondition("\"t\".\"EMAIL\" email NOT LIKE '%_#__%.__%'");
}
Why not to use regex and make a KISS approach ? better read this first...
Sql script to find invalid email addresses
I'd be glad to hear your comments it is interesting question for yii dev's btw
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.
Google Analytics API: how to extract pageviews for a specific page?
I tried using something like
ga:pagePath=~page.php%3fid%3d44 (page.php?id=44)
but it doesn't seem to work... I get "no results found" where I have 20 pageviews for sure
UPDATE
I think I found the solution
ga:pagePath==/website/page.php?id=44
for some reason I had to include the complete path and ==
To use a partial path to match for a page in filters you should use
ga:pagePath=#page.php?id=44
=# tells ga to match a substring.
What you were originally using was incorrect for this.
I think your problem is that you put the hex version of the ? and = characters into your query, which doesn't match how Analytics stores the page paths. If you change these to the normal characters it should work:
ga:pagePath=~page.php?id=44
Your other solution should work as well but is a bit more inflexible in case you wanted to tweak the query to return other pages.
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.