I've currently implemented a find function on a RichEditBox that when executed will search for query and select the found text inside the RichEditBox:
String^ docText;
currentRichEditBox->Document->GetText(Text::TextGetOptions::None, &docText);
start = currentRichEditBox->Document->Selection->EndPosition;
end = docText->Length();
int result = newRange->FindText(query, end-start, Text::FindOptions::None);
if (result != 0)
{
currentRichEditBox->Document->Selection->SetRange(newRange->StartPosition, newRange->EndPosition);
}
This kind of gets the job done, but is overall a fairly subpar experience for a number of reasons:
The typical behavior of a search is not to select the found text. Instead, when comparing against existing apps such as Microsoft Edge or Word, the focus remains on the search box instead of shifting to the result text that was found, allowing for the query to be repeated or modified.
A search should be able to highlight multiple results in the text at the same time.
With this style implementation, there is no way to enable instant search where the results update live while the user types a query.
How can I implement search in a UWP Windows 10 app that functions as a regular search function instead of selecting the found text?
Related
I am using Azure Suggestions (auto-complete) API
This API working fine for search by keywords
but there is a case like a keyword "HF - Heart failure" try to search
I am getting a result but not in short order means it should show this on the first choice but it comes the third choice I think it may be - in middle of a word
SuggestParameters suggestParameters = new SuggestParameters()
{
UseFuzzyMatching = fuzzy,
Top = 8,
SearchFields = new List<string>
{
"Keyword"
}
};
return _titleIndexClient.Documents.Suggest(searchText, "sgt", suggestParameters);}
The API that you are using from the SDK is called the "Suggestion" API. While it is possible for it to sometimes functionally work in a manner like autocomplete, the intended purpose for it is to find text/documents whose search aware fields match the term you entered.
You can find more details about the API here: https://learn.microsoft.com/en-us/rest/api/searchservice/suggestions
Fundamentally, the reason you see other suggestions besides the exact match for your query ("HF - Heart failure") in the top hits above the document you wanted to see, is because there are other documents for which your query term is more relevant.
Currently, Azure search does not have an autocomplete feature. Please keep an eye out for our blog and our documentation for announcements on things we are releasing.
I have to build a search textbox in a web page similar to facebook search box. Client side there will be ajax calls. The user need to search into around 300.000 elements that have a description of a few words or an alphanumeric code. When user enters the beginning of a word, a call is made to the server which return best match based on the starting of any word or code but also suggest first the elements most recently by the user, then by the group the user belongs to and finally from the entire set. Result can be limited to 10-20 items.
How can I build a fast search by key with the value just the description of the element? We use SQL server but any other DB could be OK.
The implementation at the time was very complex to summarise here but I came across recently to UI-select that solve the front end problem nicely and it's very good component if you are using Angular
https://github.com/angular-ui/ui-select
then backend you can put whatever you have (I did with Redis)
I add search suggestions to my search box like so...
var s = document.querySelector(".win-searchbox");
s.addEventListener("suggestionsrequested", function (e) {
e.detail.searchSuggestionCollection.appendQuerySuggestions(["one", "two", "three"]);
});
But when I run the app and use the search field too quickly, it throws one of two exceptions deep in the ui.js file having to do with adding to and removing from the suggestions list. I assume that the async script is trying to access list items that are taken out of existence already (because I'm navigating quickly... search, enter, type a new search, enter, etc.).
I can't figure out how to debug this or find a way around it. Is there a null check or something that I need to put somewhere? Thanks.
The problem was the page was navigating back to itself when the query was submitted, so I searched too quickly it tried to do navigations overlapped somehow and threw the exception. The fix was to simply replace the filter function on the ListView when the query was submitted. Obviously, this is the better way to do it anyway and the performance was dramatically improved.
I had an issue similar to this with the search box control if I searched rapidly to navigate to the search results page. My suggestions are ranked values from a 40K of JSON objects, and the result returns within 100ms. I made a global variable to hold the search promise and canceled it in my navigation onnav event.
I have setup a search scope for the current members of a website (a "Phone book" type of search). It is setup to automatically suggest limiting search results by people's jobtitles, adding something like "jobtitle:Manager" to the search query.
For single words ("Manager", "Supervisor", etc.) this works fine, but as soon as the title contains more than one word ("Managing Supervisor"), it returns zero search results. My gut feeling is that it's because when the url is entered as jobtitle:Managing Supervisor, it limits results by jobtitle = Managing, and then Supervisor simply becomes a generic search term.
I tried testing with manually added quotation marks, jobtitle:"Supervising Manager", but they are removed when I land on the search page and the effects are the same.
Is there any way to allow limiting of search results by fields with multiple words?
This is running SharePoint 2007.
Did you try adding a + between the words?
Have a bit of a difficult question which as far as I can see, no one has really managed to fix yet.
Here's the scenario. Sharepoint 2010 EnterPrise Search Centre.
I've created a custom Search Results Page. I want people who type any word in the Search box to only display results where the Value provided by the user matches with a specific Managed Search Property.
Now I know a user can search for People with specific criteria by entering for example
Continent:Europe in the actual Search Box. Sharepoint will refresh the page with the following added to the Query String: k=Continent:Europe and the results will only show people who are from Europe.
So my question is : How can I fix this so that the user does not have to enter the Continent:Europe in the Search box and can just type Europe?
Thanks
One option is to create your own webpart that acts as the search box and replaces the standard one with your custom search box. The advantage of this is that you can more tightly control the user interface and then set up the query passed to the server (with the "k" parameter). You could prepend "Continent:" before the search term entered to help narrow the search.
Another use for this is to append * onto any search term because the People search does include partial words by default.
We did this on one site to simplify the input and allow users to search with one text box (without the advanced features) and then users can use the refinements to narrow the search.