Sitecore Advanced Database Crawler NumericRangeSearchParam - search

When using Advanced Database Crawler for searching in Sitecore is it possible to combine a FieldValueSearchParam with a NumericRangeSearchParam.
For example, I would like to search for all items with a price between 100 and 200 (NumericRangeSearchParam) and in category t-shirts (FieldValueSearchParam).
I can add refinements using RelatedIds and TemplateIds but that is not enough as i need to check if it is in a specific field using:
refinements.Add("category", id);

Yes, all types of search parameters in a combined query are possible with the new version of the ADC, v2
Here are some links to get you started:
SVN source code for the v2 branch (the latest version)
A video by the author, Alex Shyba, on tools he's been working on. At some point in this video he specifically demos the features of the v2 code base and how the code works. One example is him demoing combining different search params and being able to use logical operators like AND and OR with them
Here's a direct link to a demo page (and code behind) in the above referenced source code that shows combining several types of search together. You should use this as a reference to the video example above.

Related

Search a specific search of a journal article based on the user type

I have this requirement:
We have a journalarticle and we wish to have sections which have content for internal and external users for the application.
We are able to hide the content from rendering by implementing custom template on web content display and using a simple custom-field for a user which helps us to classify it.
Having said that when we search something as an external user, the search portlet is able to fetch an article where the search text is a part of internal user content, and due to the above mentioned template the content is not visible.
In short, from the user's perspective the resultant article does not match the searched term.
I wish to seek some pointer to check whether there is a mechanism to ensure that when an external user searches something then we only search the dynamic-element of the doc which matches the user type?
We have thousands of such articles and create multiple copy of the same article does not seems viable solution.. so any pointers would be a great help.
Liferay version : 6.2 GA4 CE
Thanks!
AJ
First of all: Not finding a search term in a document can be a sign of good working synonym resolution in the search engine. It's questionable if this behaviour is always wrong or only in this particular case. Remember google bombs?
That being said, I believe that this architecture of half-visible documents is flawed from the beginning. Ideally I'd suggest to change it, for example by splitting the information to two articles, so that you can use the standard permissions to resolve. If you link both, you can determine how/which article or template to use. It's not an ideal solution, but might be a workaround.
Another workaround might be to change Liferay's indexer component and index two different versions of the article, with two different permissions. Of course, you'll have to change the search side as well, so that you'll find each article at most once, even if it's now twice in the search engine.
Again - not ideal, but might be the quickest fix that you can get right now without changing the underlying architecture. However, to change the underlying architecture is my actual recommendation.

GitHub : Is it possible to search inside code and sort by stars

I'm not sure if this is the right forum for this question. Saw quite a few Q&A related to search on GitHub, hence posting here.
E.g. Search code inside a Github project
GitHub advanced search allows terms like stars:>100 but the query term is restricted to repository names only. Is it possible to search for a term inside the files (code) & sort by stars? My aim is to see which popular repos are using a particular keyword in their code. It would be very useful if GitHub's advanced search options for Repositories worked for Code also.
It is not possible to sort by stars when searching inside code.
From an e-mail from github.com support:
Code search does not support sorting by number of stars, but I will definitely add your +1 to that suggestion internally! I can't say if or when a change will happen, but your feedback is in the right hands.
You may want to vote for this feature: Add Stars count filter.
The feedback is related to this announcement: Improving GitHub code search

Plone: creating and using document tags?

For an academic plone site I am creating, it is desirable to support document tags (see below).
There are multiple users for this site, and each user has a (long) list of publications that they alone can add / edit.
In its simplest form, a publication entry consists of a hyperlink or even just plain text. For instance:
A. Baynes, J. Watson and S. Holmes, "The role of observation and deduction in forensics", Applied Crime Solving, 221, 210-243 (1901). doi: 10.1032/acsolv2714
(The above is a fictitious article, but it has all the elements one expects in most citations.)
For those unfamiliar with DOI links, these are fixed text strings that can be resolved to the page for the article in question using dx.doi.org. Further, copyright / license terms often prohibit the authors from providing a full PDF / HTML for their articles on their websites. The articles often lie behind a paywall (usually accessible from most Universities / major research labs). So, running full text searches on the article itself is NOT an option.
Returning to the problem definition, I am assuming that the users will add their publications as links, but I want to give them the ability to specify a comma separated list of words / phrases (or tags) that more closely identify what the article is about.
For the above article, an appropriate list of tags would be:
forensics, haemoglobin, degradation of evidence
After each user appends such tags to the article, I want to create a backend that will allow visitors to the site to simply be able to enter these tags in a search field and find all publications that pertain to, say, haemoglobin.
That search should pull all publications that list haemoglobin as a tag, for all users of the site.
I intentionally used haemoglobin as a tag to illustrate that relevant tags need not be (and usually aren't) part of the text specified in the title of the article.
Further, the Plone "Collections" feature is not an adequate solution to this problem. Collections are typically generated by the admin. That means that a) admin intervention for something like this is essential and b) tags are best defined by users, not the admin.
When adding any content type (File, Folder, Page, Link, Collection, ...) in Plone, you can apply any number of tags to the content. This is done in the "Categorization" tab when editing/creating the content.
Visitors/Users can search the site based on tags like normal searches (using the search box or accessing the /##search URL).
Moreover you can use "tag cloud" portlets to visualise the tags' frequencies. Check the followings to get an idea:
1. A tag cloud portlet that rotates tags in 3D using a Flash movie
2. TagCloud
Don't forget to check Plone documentation, and specially Plone user manual to get yourself acquainted with the way Plone works.
#user2751530
I would like to know whether you are still working on this specific project - I am currently developing a similar one using plone v4, documentviewer v3 and an as of yet nonexistant frontend. I would like to discuss different approaches to the tagging-by-user problem, you can contact me through skype (dawitt19) or twitter (pref.) through #japhigu.

How to modify opencart basic search module to a more advanced one?

I am pretty new to opencart and I want to learn how can I create a more advanced search function.
For example I have products in my store, some of them are blue and some of them are red.
How can I specify or where I can specify a product's color (but not in the title, something like an attribute)?
And after that how can I search for red products?
I do not want to search by the keywords. I want a tab where to select the color and if I choose blue the search will show me all the blue products.
I hope you understand what I wish.(and can you please give me some code examples: where to add what to add to achieve what)
Thank you!
Normally, you would use Product Tags for this (field is under Product description on Product Page in Admin > Catalog > Products). You could have problems with very short tags 3 characters or less. See this post for more info:
mysql fulltext MATCH,AGAINST returning 0 results
You would add tags to your products like: red,black,brown,leather,s,m,l,xl small, medium, large
Then you could search any of the terms
[EDIT: in response to comment #1]
I would imagine that you just type multiple terms into search box:
'brown','large'
then all products that have (any? both?) of these tags returned.
You could use a Tag cloud or similar module to display tags on your pages, also you could use these terms in search field. If you search for 'brown', all products that have this tag will be returned.
You may also consider a third party extension for a more advanced search, check Opencart site's extension section.
If you want to modify/improve the search functionality yourself, you'll need to tinker with SQL queries in catalog/model/catalog/product.php
Opencart Search is considered by many to be one of the weak points of this package. There have been discussions on Opencart forums on this matter.
Just see how it works for you with the out-of-the-box setup, then if you need more functionality, look for an extension that does what you want, hire a programmer or code it yourself.

Code fragment repository search on github.com

How can I search for code fragments on github.com? When I search for MSG_PREPARE in the repository ErikZalm/Marlin github shows up nothing.
I'm using the repository code search syntax described on https://github.com/search with
repo:ErikZalm/Marlin MSG_PREPARE
No results, but MSG_PREPARE can be found inside this repository here. Am I missing something? Is there no code search on github.com?
At the time of writing this answer, compared to time this question was asked i.e. about 8 years ago, github has come a good way, though still not to the length which you are looking at.
GitHub code searches are limited on the following rules: https://docs.github.com/en/github/searching-for-information-on-github/searching-code . Quoting the same:
Code in forks is only searchable if the fork has more stars than the parent repository.
Forks with fewer stars than the parent repository are not indexed for code search.
To include forks with more stars than their parent in the search results, you will need to add fork:true or fork:only to your query.
For more information, see "Searching in forks."
So we can search within the fork using the fork:true option, though as expected, since the repo ErikZalm/Marlin is low on star count as compared to parent MarlinFirmware/Marlin, the code in the fork is still not indexed. Hence the advance search shows no good except a match to the repo.
Though, if you perform the same search on the parent, it would show the matches on the code. Here are the matches for MSG_PREPARE in the parent repo MarlinFirmware/Marlin
Fortunately, one company which I know working on this domain is SourceGraph: https://about.sourcegraph.com/
Hence, you can easily search what you intended with SourceGraph:
Here are the matches for MSG_PREPARE in the ErikZalm/Marlin using SourceGraph Cloud
Update July 2013: "Preview the new Search API"
The GitHub search API on code now supports fragments, through text-match metadata.
Some API consumers will want to highlight the matching search terms when displaying search results. The API offers additional metadata to support this use case. To get this metadata in your search results, specify the text-match media type in your Accept header. For example, via curl, the above query would look like this:
curl -H 'Accept: application/vnd.github.preview.text-match+json' \
https://api.github.com/search/code?q=octokit+in:file+extension:gemspec+-repo:octokit/octokit.rb&sort=indexed
This produces the same JSON payload as above, with an extra key called text_matches, an array of objects. These objects provide information such as the position of your search terms within the text, as well as the property that included the search term.
Original answer (November 2012)
I don't think there is anything that you would have missed.
If you search for SdFile, you would find results in .pde file, but none in cpp files like in this SdFile.cpp file.
The search was introduced 4 years ago (November 2008), but, as mentioned in "Search a github repository for the file defining a given function", GitHub repository code is simply not fully indexed.

Resources