Re: Apache Solr 8.4.1 Basic Authentication
The line webResource = client.resource(resourceUrl); defines what action I am performing example "https://localhost:8985/solr/CoreName/select?q=*%3A*; Are you setting up your URL correctly. My snippet was outlining the additional Authorization header that needs to also be part of the request but assuming you were already going to a valid URL. On 3/26/2020 3:59 PM, Altamirano, Emmanuel wrote: Thank you so much for replying my email Mike. I did use now the base64 to encode user and password but now Solr doesn’t undertint the credentials: {Accept=[application/json], Content-Type=[application/json], *Authorization*=[Basic c29scjpTb2xyUm9ja3M=]}>] ERROR[org.springframework.web.client.HttpClientErrorException: 404 Not Found] Before I got: {Accept=[application/json], Content-Type=[application/json], *Authorization*=[Basic solr:SolrRocks]}>] ERROR[org.springframework.web.client.HttpClientErrorException: 401 Invalid authentication token] Is there something else that I need to configure? *Emmanuel Altamirano,* Consultant- Global Technology International Operations *Telephone:*312-985-3149 *Mobile:*312-860-3774 *cid:image001.png@01D02A68.19FA64F0* 555 W. Adams 5^th Floor Chicago, IL 60661 _transunion.com <http://www.transunion.com/>___ This email including, without limitation, the attachments, if any, accompanying this email, may contain information which is confidential or privileged and exempt from disclosure under applicable law. The information is for the use of the intended recipient. If you are not the intended recipient, be aware that any disclosure, copying, distribution, review or use of the contents of this email, and/or its attachments, is without authorization and is prohibited. If you have received this email in error, please notify us by reply email immediately and destroy all copies of this email and its attachments. *From:* Mike Phillips *Sent:* Thursday, March 26, 2020 3:10 PM *To:* Altamirano, Emmanuel *Subject:* Re: Apache Solr 8.4.1 Basic Authentication *EXTERNAL SENDER:* Exercise caution with links and attachments. I use Jersey to talk to solr. Here is a code snippet. You seem to be on the right track but you need to base64 encode the username/password bytes. String combined = username + ":" + password; String encoded = base64.encode(combined.getBytes()); String authHeader = "Basic " + encoded; // Setup need to encode the query webResource = client.resource(resourceUrl); webResource.accept("*.*"); // Perform request response = webResource.header("Content-Type", "application/json") .header("Authorization", authHeader) .get(ClientResponse.class); respStatus = response.getStatus(); On 3/26/2020 12:27 PM, Altamirano, Emmanuel wrote: Hello everyone, We recently enable Solr Basic Authentication in our Dev environment and we are testing Solr security. We followed the instructions provided in the Apache Solr website and it is working using curl command. If you could provide us any advice of how do we need to send the credentials in the HTTP headers in a Java program? It is very appreciate it. HttpHeaders headers= *new*HttpHeaders(); headers.setAccept(Arrays./asList/(MediaType.*/APPLICATION_JSON/*)); headers.setContentType(MediaType.*/APPLICATION_JSON/*); headers.add("Authorization", "Basic "+ "solr:SolrRocks"); Thanks, *Emmanuel Altamirano,* Consultant- Global Technology International Operations *Telephone:*312-985-3149 *Mobile:*312-860-3774 *cid:image001.png@01D02A68.19FA64F0* 555 W. Adams 5^th Floor Chicago, IL 60661 _transunion.com <http://www.transunion.com/>_ This email including, without limitation, the attachments, if any, accompanying this email, may contain information which is confidential or privileged and exempt from disclosure under applicable law. The information is for the use of the intended recipient. If you are not the intended recipient, be aware that any disclosure, copying, distribution, review or use of the contents of this email, and/or its attachments, is without authorization and is prohibited. If you have received this email in error, please notify us by reply email immediately and destroy all copies of this email and its attachments.
Re: Is this a bug? Wildcard with PatternReplaceFilterFactory
It looks like the debug result you are showing me is the results for Rod's not Rod’s, but in answer to your question This is why I think "Rod’s finds fields Rod's and Rod’s that are now in the index as rod's" The analysis page shows Rod’s gets stored in the index as: rod's rods rod s Field Value (Index) Rod’s Analyse Fieldname / FieldType: _text_ Schema Browser <https://centos1:8985/solr/#/rat_11/schema?field=_text_> * Verbose Output WT text raw_bytes start end positionLength type termFrequency position Rod’s [52 6f 64 e2 80 99 73] 0 5 1 word 1 1 SF text raw_bytes start end positionLength type termFrequency position Rod’s [52 6f 64 e2 80 99 73] 0 5 1 word 1 1 WDGF text raw_bytes start end positionLength type termFrequency position keyword Rod’s [52 6f 64 e2 80 99 73] 0 5 2 word 1 1 false Rods [52 6f 64 73] 0 5 2 word 1 1 false Rod [52 6f 64] 0 3 1 word 1 1 false s [73] 4 5 1 word 1 2 false FGF text raw_bytes start end positionLength type termFrequency position keyword Rod’s [52 6f 64 e2 80 99 73] 0 5 2 word 1 1 false Rods [52 6f 64 73] 0 5 2 word 1 1 false Rod [52 6f 64] 0 3 1 word 1 1 false s [73] 4 5 1 word 1 2 false PRF text raw_bytes start end positionLength type termFrequency position keyword Rod’s [52 6f 64 e2 80 99 73] 0 5 2 word 1 1 false Rods [52 6f 64 73] 0 5 2 word 1 1 false Rod [52 6f 64] 0 3 1 word 1 1 false s [73] 4 5 1 word 1 2 false PRF text raw_bytes start end positionLength type termFrequency position keyword Rod's [52 6f 64 27 73] 0 5 2 word 1 1 false Rods [52 6f 64 73] 0 5 2 word 1 1 false Rod [52 6f 64] 0 3 1 word 1 1 false s [73] 4 5 1 word 1 2 false PRF text raw_bytes start end positionLength type termFrequency position keyword Rod's [52 6f 64 27 73] 0 5 2 word 1 1 false Rods [52 6f 64 73] 0 5 2 word 1 1 false Rod [52 6f 64] 0 3 1 word 1 1 false s [73] 4 5 1 word 1 2 false PRF text raw_bytes start end positionLength type termFrequency position keyword Rod's [52 6f 64 27 73] 0 5 2 word 1 1 false Rods [52 6f 64 73] 0 5 2 word 1 1 false Rod [52 6f 64] 0 3 1 word 1 1 false s [73] 4 5 1 word 1 2 false LCF tex t raw_bytes start end positionLength type termFrequency position keyword rod's [72 6f 64 27 73] 0 5 2 word 1 1 false rods [72 6f 64 73] 0 5 2 word 1 1 false rod [72 6f 64] 0 3 1 word 1 1 false s [73] 4 5 1 word 1 2 false This is what we were trying to achieve with the class="solr.PatternReplaceFilterFactory" pattern="’" replacement="'"/> The problem is when using wildcard *Rod’s* we get no hits || |"responseHeader":{ "status":0, "QTime":2, "params":{ "q":"*Rod’s*", "debugQuery":"on", "_":"1582315262594"}}, "response":{"numFound":0,"start":0,"docs":[] }, "debug":{ "rawquerystring":"*Rod’s*", "querystring":"*Rod’s*", "parsedquery":"_text_:*rod’s*", "parsedquery_toString":"_text_:*rod’s*", "explain":{}, "QParser":"LuceneQParser", ... | On 2/21/2020 11:52 AM, Erick Erickson wrote: Why do you say “…that are now in the index as rod’s”? You have WordDelimiterGraphFilterFactory, which breaks things up. When I put your field definition in the schema and use the analysis page, turns “rod’s” into the following 4 tokens: rod’s rods rod s And querying on field:”*Rod’s*” works just fine. I’m using 8.x, and when I add “=query” to the URL, I see: { "responseHeader": { "status": 0, "QTime": 10, "params": { "q": "eoe:\"*Rod's*\"", "debug": "query" } }, "response": { "numFound": 1, "start": 0, "docs": [ { "id": "1", "eoe": "Rod's", "_version_": 1659176849231577088 } ] }, "debug": { "rawquerystring": "eoe:\"*Rod's*\"", "querystring": "eoe:\"*Rod's*\"", "parsedquery": "SynonymQuery(Synonym(eoe:*rod's* eoe:rod))", "parsedquery_toString": "Synonym(eoe:*rod's* eoe:rod)", "QParser": "LuceneQParser" } } What do you see? Best, Erick On Feb 21, 2020, at 12:57 PM, Mike Phillips wrote: Rod’s finds fields Rod's and Rod’s that are now in the index as rod's but *Rod’s* finds nothing because the index now only contains rod's
Is this a bug? Wildcard with PatternReplaceFilterFactory
Is this a bug? Wildcard with PatternReplaceFilterFactory Attempting to normalize left and right single and double quotes for searches ‘ Left single quotation mark ' Single quote ’ Right single quotation mark ' Single quote “ Left double quotation mark " Double quotes ” Right double quotation mark " Double quotes positionIncrementGap="100" multiValued="true"> words="stopwords.txt" /> preserveOriginal="1" catenateWords="1"/> replacement="'"/> replacement="'"/> replacement=""/> replacement=""/> preserveOriginal="1" catenateWords="1"/> words="stopwords.txt" /> synonyms="synonyms.txt" ignoreCase="true" expand="true"/> replacement="'"/> replacement="'"/> replacement=""/> replacement=""/> The wildcard seems to NOT utilize the PatternReplaceFilterFactory Rod’s finds fields Rod's and Rod’s that are now in the index as rod's but *Rod’s* finds nothing because the index now only contains rod's
Highlighting
I don't understand why highlighting does not return anything but the document id. I created a core imported all my data, everything seems like it should be working. From reading the documentation I expect it to show me highlight information for assetName around Potter, but I never get anything but the document id (assetId) Here are the entries I added to managed-schema for assetName. Anybody know what I should be targeting as a solution. #- My query and results -# 0 1 Potter on /EM clientId:11 assetTypeId:1 EM 1555116259160 3 Harry Potter and The Order of The Phoenix.mov 2012-09-27T02:34:27Z Quicktime with Audio 1 11 Level 3 27 27 Harry Potter and The Order of The Phoenix.mov 23.976 Non drop frame 2.35 16 4:2:0 1624857205677228032 3 StudelyCastleHotel 2019-04-12T22:57:33Z JPEG 1 11 Level 3 10130 10130 Producer Michael Potter 7 StudelyCastleHotel 1630650901282684928