Sharepoint Custom Search Results Page using FullTextSQLQuery - c#

I'm trying to create a customized search that displays results based on my FullTextSQLQuery results (i.e. user types 'Foo' clicks Search, my server-side code performs a FullTextSQLQuery bringing back PDF documents that contain 'Foo' in its text).
My question is what will I need to do after getting the results from my query in order to display the results to the user? Will I need to provide my own results aspx page or does SP have something that is out-of-box that I can use to perhaps pass my results along to?

I'm not aware of anything OOTB, but this is a simple matter of transforming the XML results into HTML using an XSL.

Related

Saving SSRS multi select parameter value with wildcard

I have searched and searched and have not been able to find the answer to this. I'm no stranger to SSRS, .Net (c# and vb.net), SQL, etc...been in it for years. I currently have a multi-select report parameter that is populated by a dataset in my report. There are hundreds of entries, so I built it to be driven by a wildcard character in a preceding parameter. Everything works fine right now. My question is this: is it possible to enter a wildcard value, select one (or more) of the filtered values and then store that/those value(s) on selection so that a user can go back and enter another wildcard value and select from a newly filtered list? (Basically, remember what has been selected in the overall dataset before report execution and create some sort of comma-separated list as the final parameter value to be passed to the report) I realize this may be better served in a web app w/a reportviewer control, but I'm trying to avoid deviating from the native SSRS server if possible. Thanks in advance!
The way I might approach this (not actually done it but the theory sounds ok)
Have 2 parameters for user input, your current one and a hidden one called say #filter (visible) and #filterHistory (this is the hidden one)
Have a textbox (formatted like button) with something like "Refine" as the text. Set the action to call your report again but set the #filterHistory to be something like #filterHistory & ", " & #filter. Basically we keep appending the last user input to the history.
Then your report would filter based on both parameters. You'll have to do some parsing of the delimited parameter now to split it out into the constituent parts but you get the idea.
I've no time to build a test report but hopefully that will point you in the right direction. If it doesn't help or work then comment and I'll see if I can knock up a quick example.

How do you implement an auto-updating search box so that the names appear as you type?

I have an index page where a table is generated with rows of information from the DB.
I have successfully integrated Tom Dykstra's method of adding a search box using this tutorial: http://www.asp.net/mvc/overview/getting-started/getting-started-with-ef-using-mvc/sorting-filtering-and-paging-with-the-entity-framework-in-an-asp-net-mvc-application
How would I implement behavior that shows names that already exist as they are being typed in the search box, or automatically update the rows in the table as something is typed into the search box?
I am using MVC 5 with EF6.
Thank you!
I would use the jQuery UI Autocomplete widget with a remote source for the data.
https://jqueryui.com/autocomplete/#remote
For the remote source either write a new action on your controller that returns JSON, or a WebAPI action to do the same, and in there do a query against your database to find matching results for the users query
The best way to do this would be to use AngularJs. We can't give you a full example of this, I can only give you an approach. Angular is very powerful and as well it is client side which speeds up you application very much. See the example shown in the docs of angular.
You can use the filtering on everything (tables, divs, list etc.)
https://docs.angularjs.org/api/ng/filter/filter
Here is an example of how to implement AngularJS in Asp.Net MVC.
http://www.codeproject.com/Articles/806029/Getting-started-with-AngularJS-and-ASP-NET-MVC-Par
Here is also an JSFiddle example on how it can look like:
http://jsfiddle.net/mikeeconroy/QL28C/1/
<tr ng-repeat="product in products | filter:search | orderBy:'name'">
<td>{{product.name}}</td>
<td>{{product.category}}</td>
</tr>
This code snippet would do the filtering for you

Lucene.Net. How to search through HTML entities

How to search through html entities in lucene.net?
All my index in numeric html entities, so if I search for example "34" it comes &#<b>34</b>;
Also very interesting, how to make search through different fields with different words like in SQL. for example search phrase "word1 word2"
SELECT * FROM table WHERE
title LIKE 'word1%' OR title LIKE 'word2%' OR
description LIKE'word1%' OR description LIKE 'word2%'
It comes down to how you store it. When you store your document, it appears you're storing your HTML and searching on it.
I recommend that you have two separate fields:
One stores the raw HTML, but it is not analysed (there's no need to search on the markup, is there?)
One contains the HTML that is processed for searching. This field is not stored but it is analyzed.
In order to populate the second field, you should run the HTML through something like HTML Agility Pack to get the inner text of the HTML nodes you're storing/processing, and then run that text through the HttpUtility.HtmlDecode method to get the text that the HTML entities represent which you can actually analyze and search on.
Then, you can search on the analyzed field for whatever you wish without doing anything special, and then retrieve the content from the field that stores the raw HTML.
In regards to wildcard searches, they are supported, you just have to build your query appropriately (assuming you are using a QueryParser). Note that wildcard prefixes are not enabled by default.

query a website and retrive public data from it

I am really new in c# programming. I would like some help from you guys (if possible). I have a website (it is a shopping website ) with data : products, price, description...etc. What I would like to do is: Since the website has a search capability so I would like to get the data from it by querying the search link and get only the important data (product id, name, price and description). When I perform the search I get many pages, and every time I press next I get new page with extra list of products. How can I simply make automation of these tasks?
I searched a lot over internet I found that I need to use webclient() with regular expression, and I thought that maybe a loop over the page content and over the search result pages would be necessary.
what do you think guys?
Website Example.
I´ll appreciate any effort from your side.
What you're describing is called scraping.
What you'll want is to use something like HtmlAgilityPack to get the website. Then you find the nodes you're interested in by using the DOM, and reading their inner text.
The whole process is rather complicated, but at least I've sent you off in the right direction. For the most part, search urls tend to have the same format.
In your link for instance
http://cdon.se/hemelektronik/advanced-search?manufacturer-id=&title=.&title-matchtype=1&genre-id=&page-size=15&sort-order=142&page=2
You can change 'page' to be smething else and you can go through all the pages that way.
Added:
Also don't TRY to use regex to parse html. It drove one particular person mad...
RegEx match open tags except XHTML self-contained tags

Rendering Dynamic asp.net webpage into string invoked from another page

The question basically drill's down to these two C# 2.0, ASP.NET 2.0 webpages.
viewtemplate.aspx
generatetemplate.aspx
Purpose of these:
viewtemplate.aspx - Displays Email template defined in 'generatetemplate.aspx', with client assigned data pulled from database
generatetemplate.aspx - Is the actual page that contains place holders for client to put data.
[i named it so because that's the file i will be generating email to be sent from]
Requirement:
I will be requesting the generatetemplate.aspx from viewtemplate.aspx
, get the rendered output of generatetemplate.aspx and then send that output as email to the recipients.
It is the rendering part which i don't know how to do.
Note:
I will be calling generatetemplate.aspx from viewtemplate.aspx with query string so that generatetemplate.aspx will Pull value from database and then render rather than rendering with default values
You wish to get the rendered HTML output of running the page? You can download it from an HTTP request like a browser would with the WebClient class.
string generated = new WebClient().DownloadString("generatetemplate.aspx?myparams=params");
"generated" will then contain rendered output that you can do whatever you like with.
if I got question right, this is looks dodgy a bit.
I've used XSL + XML for such case. So you just prepare data in XML format, than applying XSL layout and thats it.

Categories

Resources