open-semantic-search
open-semantic-search copied to clipboard
Where to find query in backend when we hit search button from main UI
I am unable to find the starting point of main UI from where we search queries.. I want to do changes in solr uri which we use for searching result from solr db. Can anyone please help me?
Hi Rahul,
Nice, youre getting into this software.
To answer your question, let me quickly sketch you the components of this project:
-
this repository holds the backend of the Software, the input processing and the search data core Solr
-
the other one installed along is the Frontend, specifically solr-php-ui
This Frontend is on PHP.
To do a bit of backtrace:
The simplest search is a * (for everything, eg if you click on "newest documents").
Then you end up on the list view, which is coded here as template (https://github.com/opensemanticsearch/solr-php-ui/blob/master/src/templates/view.list.php).
If you want to modify how its being handled, you can dip into it right there (for example I put a pdf preview and a jQuery Fancybox in between)
you will see that this uses all the search result items in $results.
In /src/template/index.php all result views are gathered together.
(There for example, I modified the search button into a dropdown button to hold search presets, like search paths to search within)
On /src/index.php you have the entry point for the whole web client.
To get back to the query, on line 1452 (https://github.com/opensemanticsearch/solr-php-ui/blob/master/src/index.php#L1452) you see such a query:
$results = $solr->search($solrquery, $start - 1, $limit, $additionalParameters);
where $solr is an object of class Apache_Solr_Service defined here (https://github.com/opensemanticsearch/solr-php-ui/blob/master/src/index.php#L881)
File Service.php holds the definition of Apache_Solr_Service where you just:
- create an instance (by connecting to the host, port, and core)
- you form a query
- and you pass it along to the method search
https://github.com/opensemanticsearch/solr-php-ui/blob/master/src/Apache/Solr/Service.php
You should be doing well with the already provided standard queries. If you need more, you can form queries of your own, following this guide:
https://lucene.apache.org/solr/guide/6_6/the-standard-query-parser.html
Happy coding and greetings from Switzerland!
Andy
Von: Rahul Tewatia [email protected] Gesendet: Montag, 2. November 2020 09:17:04 An: opensemanticsearch/open-semantic-search Cc: Subscribed Betreff: [opensemanticsearch/open-semantic-search] Where to find query in backend when we hit search button from main UI (#327)
I am unable to find the starting point of main UI from we search queries.. I want to do changes in solr uri which we use for searching result from solr db. Can anyone please help me?
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/opensemanticsearch/open-semantic-search/issues/327, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AGHTGF26HOKDHUWOIVZETJ3SNZTIBANCNFSM4THE7LBA.
I don't know what you mean by "changes of URI", if only the URL of the server or if you want to extend/change Solr HTTP-API options (so see previous architecture related post from Andy).
If you want "only" set another Server IP/URL, you can use like Docker-compose.yml config does the environment variable SOLR_PHP_UI_SOLR_HOST or set in /etc/solr-php-ui/config.php by $cfg['solr']
If you want to debug or learn which Solr query is generated/sent you can see in Solr log where there is for each select request (search) the array "params" in the line of the log so you can use the value in this array as HTTP/REST-API option of own solr/corename/select? call and add parameters like debug on.
Thankyou so much Andy.
Mandalka I was trying to add some more fields while solr indexing (vector embeddings) for that I need to change the solr URI(not the standard one on which solr is running) along with more fiels in the URI.
Thanks a lot again.
Warning: The solr Parameter qf which configures which fields to query in Solr index is changed dynamically in (multiple occuring) variable $additionalParameters['qf'] in index.php so maybe better to make some things like base query fields or "add additional queryfields" as config option, if you don't want to have to maintain a separate branch/fork instead of a custom config.