it seems to be an issue / bad configuration in my solr index.
In detail when I perform a search by using some words in my query the solr result is ok, it returns me 50 entries.
Let me show an example :
Example 1)
url = http://mydomain:8983/solr/mycore/select?q=walk%20in%20the%20city
query = walk in the city
results = 231373, 231372, 231454, ....
Unfortunately when I use a single word in my query the solr result is "truncated"
Let me show some examples :
Example 2)
url = http://mydomain:8983/solr/mycore/select?q=Walk
query = Walk
results = 231373, 231372
Example 3)
url = http://mydomain:8983/solr/mycore/select?q=city
query = city
results = 231373, 231372
As you can see "Walk" and "city" words are inside my first query set.
The results in examples 2/3 are the same.
I'm a beginner in using solr, probably I perform some mistakes in solr configuration.
What I have to check first in order to optimize the query?
Thanks in advance.
Best regards.
Sergio
I would suggest to add debugQuery=true to your query and look at the debug node in the result. Under debug in particular look at the parsedquery to see what Solr is doing with your query, like what fields it's searching and whether it is using AND or OR between expressions (e.g. +fieldName means AND).
Also, under the debug there is an explain node that contains the documents that were found and why they were found. That should help you pin point why those records were returned. The explain output is pretty convoluted, but there is a lot of useful information there for this kind of issues.
(I realize this is not quite an answer to your question, but it's too long for a comment.)
Related
I am working on the below query and trying to implement an ArangoDB wildcard search. The criteria is very simple, I'd like to match records similar to the name or a number field and limit the records to 25. The query works but is very slow, taking upwards of 30seconds. The goal is to optimize this query and get it as close to sub second as possible. I'd like the query to function similar to how a MySQL LIKE would work, matching using the % wildcard on both sides.
https://www.arangodb.com/docs/stable/release-notes-new-features37.html#wildcard-search
Note, one thing I noticed is that in the release note examples, rather than using FILTER, they are using SEARCH.
Additional info:
name is alphanumeric
number is going to by an 8 digit number
LET str = CONCAT("%", 'test', '%")
LET search = (
FOR doc IN name_search
FILTER ANALYZER(doc.name LIKE str, "text_en") OR
FILTER ANALYZER(doc.number LIKE str, "text_en")
LIMIT 25
RETURN doc
)
RETURN SEARCH
FILTER doesn't utilize indices. To speedup your wildcard queries you have to create an ArangoSearch view over a collection and use SEARCH keyword.
Feel free to check the following interactive tutorial (see "LIKE Support" section):
https://www.arangodb.com/learn/search/arangosearch-tutorial-3-7/
Objective
All I am trying to do is retrieve a single record from a specific table where the primary key matches. I have a feeling I'm greatly over complicating this as it seems to be a simple enough task. I have a theory that it may not know the variable value because it isn't actually pulling it from the Python code but instead trying to find a variable by the same name in the database.
EDIT: Is it possible that I need to wrap my where clause in an expression statement?
Attempted
My Python code is
def get_single_record(name_to_search):
my_engine = super_secret_inhouse_engine_constructor("sample_data.csv")
print("Searching for " + name_to_search)
statement = my_engine.tables["Users"].select().where(my_engine.tables["Users"].c.Name == name_to_search)
# Print out the raw SQL so we can see what exactly it's checking for
print("You are about to run: " + str(statement))
# Print out each result (should only be one)
print("Results:")
for item in my_engine.execute(statement):
print(item)
I tried hard coding a string in its place.
I tried using like instead of where.
All to the same end result.
Expected
I expect it to generate something along the lines of SELECT * FROM MyTable WHERE Name='Todd'.
Actual Result
Searching for Todd
STATEMENT: SELECT "Users"."Name", ...
FROM "Users"
WHERE "Users"."Name" = ?
That is an actual question mark appearing my statement, not simply my own confusion. This is then followed by it printing out a collection of all the records from the table, as though it successfully matched everything.
EDIT 2: Running either my own hard coded SQL string or the generated query by Alchemy returns every record from the table. I'm beginning to think the issue may be with the engine I've set up not accepting the query.
Why I'm Confused
According to the official documentation and third party sources, I should be able to compare to hardcoded strings and then, by proxy, be able to compare to a variable.
I'm performing an XPATH search in (Day CQ) CRX, and I'm trying to limit the results returned by the query.
After reading every possible forum on the internet, I came to understanding that
(//my-component)[position() <= 5]
should return the first 5 elements that match the query, as noted here.
I get, Unsupported expression with position(). Only = is supported.
I also try last() for example, but I get all the results back.
Any help on how to limit the number of results would be much appreciated.
Thanks
I am newest in Lucene.
I'm using Lucene.NET version 2.9.4.
What is the difference between these queries?
the first is:
title:hello AND tags:word
the second is:
+title:hello +tags:word
I testing a software, and I note that the first returns 3 records, and the second returns many records.
I observe that the first returns records where title and tags fields are fuel, but the second returns records where title and tags can be empty.
Is it the difference?
There is no difference between the two. clause1 AND clause2 is effectively shorthand for +clause1 +clause2
Similarly: clause1 clause2 = clause1 OR clause2
Note, there is really no equivalent for +clause1 clause2 using the boolean operators.
Are you sending the query over the Internet, if you are and not urlencoding the request correctly it could be misinterting the '+' as an encoded space and therefore lucene just runs the second query as if the +'s not there which would just OR the two parts and give the results you get.
title:hello tags:word
I need to get the data from cassandra with out case sensitive. Please help me.
There is no case-sensitivity concept in Cassandra. All the data is stored as byte[], so it's not even a String.
You can make a custom comparator (see the API) which transforms byte[] to String and disregards case.
The other thing to do is just get the data and transform it on the client side.
Actually, your question is quite unclear as of what is your goal, so I can't give more details.
Update: Run a one-time job that fetches all records from the db and updates them, setting to lower-case. Then continue inserting everything with lowercase.
This has been resolved if you have SOLR enabled using:
CREATE SEARCH INDEX ON tableName WITH COLUMNS *, camelCaseColumn { lowerCase : true };
An index is created that allows the select statement to use lowercase in the where clause. For more details search for LowerCaseStrField.