I have integrated Solr search with my ektron site. And for search functionality I used Search framework API.
I am getting the search results as well. Now I want my search result to display in some particluar order. ie. the result item with target url that contains the search text should come first, followed by some other contents and so on.
I came to know that by modifiying the query text that passing to the Solr can return the desired result.
eg : title:testkeyword
But I can't do the same with target url and and cant boost up items.
Do any know how to modify the query text to get the desired result.
Use dismax and edismax to get better results ,
http://wiki.solarium-project.org/index.php/V3:EDisMax_component
http://wiki.solarium-project.org/index.php/V2:DisMax_component
Related
I have the Search plugin enabled - all good. ie not the DocSearch plugin.
I am wondering whether there is an option to keep the search results until a new search is performed, or the last search string is removed?
eg search for "dog" could list multiple page results, I click the first one but decide it isn't what I want. To see the next result I need to enter "dog" again.
If I need to implement that myself, any suggestions for an approach?
I am completely new to VuePress.
Thanks,
Murray
I have a problem with the Search API on Drupal 8.7.14; the site is in Hebrew.
When I try to search for more than one word, I get no results. If I search for only one word, all results that contain that word appear. The search view is already configured with a full search filter criterion.
Do you have any ideas?
https://www.screencast.com/t/Pv6jC1X6n
(8.x-1.8 search API version)
I guess you're using the wrong operator for this filter, use "contains any of these words", like on screenshot https://i.stack.imgur.com/6nB1k.png
I have found a similar question earlier here:
Google Analytics Visitors Flow: grouping URLs?
However I'm confused because people suggest different way to write the Replace String, and either way I try it am not able to make it work.
So I have a ecommerce site with hundreds of different pages. The different parts of the website is:
http://example.com/sv/ (Root)
http://example.com/sv/category/1-name/
http://example.com/sv/product/1-name/
http://example.com/sv/designer-tool/1-name/
http://example.com/sv/checkout/
When I go to the visitors flow. I want to see the amount of people that go from example Root to Category, and from Category to Product, and from Product to Designer Tool, and from Designer Tool to Checkout. However now when I have so many different pages it becomes very difficult to follow the visitors flow, because the product pages are for example not grouped together.
So instead of above. I would like to remove the 1-name/ part in the end. And only see /sv/category/, /sv/product/, /sv/designer-tool/.
In the earlier post I understand you can use an advanced filter to do this. I have set the following settings:
Type: Search & Replace
Field: Request URI
Search String: ^/(category|product|designer-tool)(/\d*)(.*)
Replace String: /$A1$A3
I guess that my search string and my replace string is wrong. Any ideas?
EDIT: I updated my filter to the following:
Search String: ^/sv/(category|product|designer-tool)(/\d*)(.*)$
Replace String: /sv/\1/
Still testing and unsure if it's the correct way to set it up.
I was able to solve this by the Search String and the Replace String in my edit above.
So basically what I did was:
Create a secondary view/profile for your site. If you apply your filter to your one and only view/profile that means that you won't be able to see any detailed data about specific pages, because the filter removes/filter that.
Add an Advanced Filter with the following settings:
Type: Search & Replace
Field: Request URI
Search String: ^/sv/(category|product|designer-tool)(/\d*)(.*)$
Replace String: /sv/\1/
You need to wait 24h after creating your new profile/view before you can see any data in it.
So my confusion was regarding the Search and Replace String. The Search String is an regular expression for matching everything after your .tld. So for example http://www.example.com/sv/mypage/1-post/, the Search String will only search within /sv/mypage/1-post/.
The Replace String is what it should replace the whole Search String with. So in my case, I matched all URL's that had /sv/category/1-string/. I wanted only to keep the "category" part, so I replaced the whole string with /sv/category/ by inputting Replace String /sv/\1/
/sv/ means just what it says. \1 means that it should take the value of the first () of my Search String (In this case "category"). The ending / is just an ending slash.
All in all, it means that any URLs that looked like http://example.com/sv/category/1-string/ was changed to http://example.com/sv/category/. Meaning that I can now see data for all my categories as a group, instead of individual pages.
I'm constructing an apachesolr query in my Drupal module programmatically and have had success with some aspects, but am still struggling with others.
So far, I have been able to construct a query that can search for specific text and limit the results based on terms to be filtered by with the following code:
$subquery_region->addFilter('tid', $term->tid);
$query->addFilterSubQuery($subquery_region, 'OR', 'AND');
What I'd like to achieve next is to be able to narrow the search further by adding a filter for finding certain text within a specific field in the node. Has anyone been able to do this.
I've been researching online and have tried lots of different ways such as adding the filter directly to the main search query
$query->addParam('fl', 'ss_my_field');
$query->addFilter("ss_my_field", "field_substring_to_search_for");
As well as breaking that out into a subquery to add to the main search query
$subquery_test = apachesolr_drupal_query("Test");
$subquery_test->addParam('fl', 'ss_my_field');
$subquery_test->addFilter("ss_my_field", "field_substring_to_search_for");
$query->addFilterSubQuery($subquery_test, 'OR', 'AND');
But none of these are working. They are returning an empty set, even though I know the substring exists in the field I'm adding as a filter and it has been indexed. I have verified through the apachesorl views module that the search index has been populated with that field and can see the substring exists.
Is there anything wrong with my syntax or the way I'm building the query?
If you know how to add filters for searching for text within certain fields, please share! It may not even be done with the addFilter function, but that's all I have been trying so far.
Thanks!
First you have to create an index for that specific field.
function hook_apachesolr_update_index(&$document, $node) {
$document->ss_your_field_name = $node->your_field_name;
}
where ss_* is the pattern.
ss_* -> String
is_* -> Integer
im_* -> Integer, Multivalued
After that you have to
1. delete the index - admin/settings/apachesolr/index
2. re-index the content
3. run the cron
4. check the filter that you created - admin/reports/apachesolr/index
Then, you can add filters
$query->addFilter("ss_your_field_name", "value");
Hope this helps you.
function hook_apachesolr_modify_query(&$query, &$params, $caller){
$subquery = apachesolr_drupal_query();
$subquery->add_filter("ss_my_field", "field_substring_to_search_for");
$query->add_subquery($subquery, "AND");
}
I'm using YQL to retrieve an RSS feed using javascript (as json), for example i use the following query:
select * from rss where url = "http://feeds2.feedburner.com/ajaxian"
The response contains the feed items, already parsed as json and everything is cool so far.
Now, I also want to get the title of the entire feed (not the title of a specific item) - but it's not a part of the result (even though the original XML feed contains it).
There is the possibility of querying the original XML itself. for example:
select channel.title from xml where url = "http://feeds2.feedburner.com/ajaxian"
and it indeed returns the feed title for that specific RSS, but that query is only valid for a RSS 2.0 formatted feeds, which stores it under rss\channel\title.
What about atom feeds which store the title under feed\title ?
What about other formats?
My question is - is there any generic way to request the feed's title through YQL? maybe somehow along with the feed itself?
thanks,
You can use the feednormalizer table to convert the feed (regardless of its format) into one of the standard formats, then grab the title from the proper node for that format.
To take the Ajaxian feed, "normalize" it as Atom and get the feed title, the query would look like:
SELECT title
FROM feednormalizer
WHERE output="atom_1.0" AND url="http://feeds2.feedburner.com/ajaxian"
(Try this in the YQL console)
There are also other tables that you can use like feed, rss and atom.
Regarding your follow up question of how to find data tables:
Go to the YQL console, make sure that the Community Tables are loaded (should already be the case with this link) and then just type in the search box on the right hand side what you are looking for. Often you can find something useful.