Download Dtsearch Syntax Manual Free

Posted on
8 May 2014CPOL
In this article, I’m going to add the Telerik UI for ASP.NET to my previous Faceted Search with dtSearch article and do some refactoring to make my search page look better and easier to use.
  • The dtSearch PDF Search Highlighter is a free plug-in for Adobe Reader that makes it possible for dtSearch and other search programs to highlight hits in retrieved documents inside Adobe Reader DC, XI, and X. Earlier versions of Adobe Reader had this feature built in, so there was no need for a plugin.
  • Sub-index size - determines the size of each sub-index created when you generate a dtSearch index. The minimum value is 1000. The minimum value is 1000. Sub-index fragmentation threshold - determines the fragmentation level at which the system automatically compresses a dtSearch sub-index during an incremental build.

This article is in the Product Showcase section for our sponsors at CodeProject. These articles are intended to provide you with information on products and services that we consider useful and of value to developers.

Bash Reference Manual Reference Documentation for Bash Edition 5.0, for Bash Version 5.0. December 2018 Chet Ramey, Case Western Reserve University. The dtSearch PDF Search Highlighter is a free plug-in for Adobe Reader. Format to PDF manuals in a single step DocAnywhere. The syntax student is led carefully through argumentaiton to current syntactic theory and at the end has a clear understanding not only of the whats of syntax but also the whys.' Professor Lisa deMena Travis, McGill University. No thanks 3 months free. Find out why Close. DtSearch tutorial video 1 alltogether lerarontogether. Unsubscribe from alltogether lerarontogether? Cancel Unsubscribe. Welcome to ManualNGuide.Com, the place where you can read or download user manuals, guides and other documentations for your products for free.

Part 1: Faceted Search with dtSearch (using SQL and .NET)
Part 2: Turbo Charge your Search Experience with dtSearch and Telerik UI for ASP.NET

Related Article: A Search Engine in Your Pocket -- Introducing dtSearch on Android

Introduction

I previously wrote an article about how to get started using Faceted Search functionality with the dtSearch library. The code was a bit complex, but did achieve my goal of not querying my SQL database for every search request. I want to spruce things up a bit, and make the code a bit simpler. In this article, I’m going to add the Telerik UI for ASP.NET and do some refactoring to make my search page look better and easier to use.

Layout – Let’s make this easier to see

The first problem that I want to address, is making the left column of facets in my search results less fixed to a certain width. That width is assuming a size of the browser requesting the content. To make this a bit more flexible, I’m going to wrap the entire page in a Telerik RadSplitter with RadPanes. With two horizontal panes, this will give a bit of a framed effect, with the content in the left column being allowed to grow or hide behind scrollbars based on when the split bar resides. The markup to create this layout starts with the following:

Listing 1 - Layout of the RadSplitter and Panes

The RadSplitter will contain two panes, split vertically courtesy of the Orientation attribute. The panes are presented left to right in the order they appear in the markup. The left pane has a minimum width of 150 pixels, and a maximum width of 300 pixels. A RadSplitBar control is next; this is the bar that the user can drag to resize the two panes. The final pane will fill the remaining space. No additional C# code is required to make this layout function in the browser.

Search Results Grid – Now with Sorting!

While my previous presentation used a grid and presented the information about my product search to the user in a clean format, it would be nice to show some other features of the products and allow sorting of the results. Fortunately, dtSearch and the Telerik RadGrid both have sorting functionality. Let’s display our search results in the RadGrid and connect its sort function to our dtSearch sort handler.

I’ve completely ‘tricked out’ my RadGrid with the following markup:

Let’s review this markup; there’s a lot going on:

  • Event handlers are defined for PageIndexChanged, PageSizeChanged, SortCommand, and ItemDataBound.
  • Sorting, Paging, and CustomPaging are activated. CustomPaging is particularly necessary in order to drive the custom data paging operation that is required by the dtSearch SearchJob object. Normally, the Telerik RadGrid will handle sort and page operations automatically when an IQueryable collection is passed to it. We’ll look at how to implement those handlers next.
  • The columns are defined with appropriate formatting, and AutoGenerateColumns disabled. This prevents some extra properties of our ProductSearchResult from being converted into columns. I could have defined a SortExpression value on these columns to define how the server-side should sort each column. Without this attribute, the sort field defaults to the name of the field bound to the column.
  • The ClientSettings – Resizing - AllowColumnResize is set to true to allow the end-user to be able to resize columns as they desire.

I have refactored the DoSearch method from my previous article to have the following signature, where it will return a collection of ProductSearchResult objects:

Listing 3 - New DoSearch method signatiure

This allows me to connect my grid_SortCommand method to pass along to the DoSearch method the sort information the grid is submitting to the server. The syntax for the paging operations are very similar, delegating paging operations back to the DoSearch method:

The sort operation in the dtSearch SearchJob could not be any more straightforward. SearchJob.Results has a Sort method that will accept the same name of the field that was stored to sort on. I added an extra bit to handle the NewSortOrder property being passed in to the method so that it can be passed along like a normal sort expression to the DoSearch method. The snippet added to my DoSearch method looks like:

Listing 5 - Sorting mechanism with SearchJob

The initial sort mechanism is to sort based on the relevance of the search result. For a field to be sorted against, that field’s name is passed in to the Sort method and the SortFlags are set appropriately for ascending or descending order. The only catch in this sort operation with dtSearch is that the search results are fetched first and then sorted. Consequently, I need to raise the limit on the SearchJob.MaxFilesToRetrieve to something astronomical so that I am sure all of my results are fetched in one batch before the sort operation is applied.

To complete the grid of product data, I modified my paging operation in the DoSearch method to now fetch each of the fields in the product from the search results. The full syntax of DoSearch is below:

First, you’ll see that I am filtering using a property called FacetFilter. This is a string value that is being passed back into my page from my facet list on the left side. I have updated this column to use a Telerik RadPanelBar. The markup for this is easy, and defines the three facets I want to be able to filter on:

Listing 7 - Markup to support the facet PanelBar

This control will give an accordion look and feel to the facets displayed on the page. The data for each of the facets being presented is updated in the ExtractFacets method:

You’ll see this time, instead of writing a header and line items into the panel, this code is finding the facet header and adding panel items inside of that header’s content area. The value of the panel item is defined as a name-value pair so that I can construct the appropriate filter criteria in the search method. The onclick handler for these items just triggers another search operation with the FacetFilter set to the value of the Panel Item submitted.

Listing 9 - Facet Item Click operation

Highlighting Results, with Style!

You will notice this time I’m not returning the highlighted results with the product data in the grid. I’ve updated my page to present that code in a handy hover tooltip using the Telerik TooltipManager control. This control allows me to define a server-side method that will fetch and return the appropriate HTML to display in the tooltip.

The markup for the tooltip is represented by this syntax for the ToolTipManager:

The RenderInPageRoot value means that the panel that is used to house the tooltip will be rendered on the root of the HTML on the page, and not inside of another element. This is useful for this sample, as we will be showing the tooltip relative to a grid row.

I define the relationship between the ToolTipManager and the grid through the ItemDataBound event handler on the grid. I add the grid row to the tip manager’s collection of target controls with this code:

Listing 11 - Adding GridRows to the collection of controls managed by the ToolTipManager

Finally, to make our highlighted search results appear in the tooltip, I implemented the tipMgr_AjaxUpdate event handler to add the highlighted results to the requesting HTML panel hosted by the tooltip. Since I wrote my HighlightResult method statically in the previous article, I can reuse that method to fetch and add the HTML to the div:

Listing 12 - Syntax to add highlighted results to the Tooltip

Results

The tooltip and sorting options added make the results grid a great deal easier and friendlier to use. As a consumer, I want to be able to search for products and then sort by price or some other field that is important to me. The Telerik controls make the screen much easier to read, and the results stand out with no additional coding or design work.

Figure 2 - Search Results using Telerik UI for ASP.NET

Summary

dtSearch provides a wealth of capabilities for an Enterprise grade search library. Coupled with a first class user-interface tool like the Telerik UI for ASP.NET, amazing results can be delivered with a little bit of integration work. Offload the work to search and present your enterprise data to dtSearch. Download a developer trial copy at www.dtsearch.com and get your trial of the Telerik UI for ASP.NET at Telerik UI for ASP.NET

More on dtSearch
dtSearch.com
A Search Engine in Your Pocket – Introducing dtSearch on Android
Blazing Fast Source Code Search in the Cloud
Using Azure Files, RemoteApp and dtSearch for Secure Instant Search Across Terabytes of A Wide Range of Data Types from Any Computer or Device
Windows Azure SQL Database Development with the dtSearch Engine
Faceted Search with dtSearch – Not Your Average Search Filter
Turbo Charge your Search Experience with dtSearch and Telerik UI for ASP.NET
Put a Search Engine in Your Windows 10 Universal (UWP) Applications
Indexing SharePoint Site Collections Using the dtSearch Engine DataSource API
Working with the dtSearch® ASP.NET Core WebDemo Sample Application
Using dtSearch on Amazon Web Services with EC2 & EBS
Full-Text Search with dtSearch and AWS Aurora

I mentioned at the outset that R syntax is a bit quirky, especially if your frame of reference is, well, pretty much any other programming language. Here are some unusual traits of the language you may find useful to understand as you embark on your journey to learn R.

[This story is part of Computerworld's 'Beginner's guide to R.' To read from the beginning, check out the introduction; there are links on that page to the other pieces in the series.]

Assigning values to variables

In pretty much every other programming language I know, the equals sign assigns a certain value to a variable. You know, x = 3 means that x now holds the value of 3.

Not in R. At least, not necessarily.

In R, the primary assignment operator is <- as in:

x <- 3

But not:

x = 3

To add to the potential confusion, the equals sign actually can be used as an assignment operator in R -- but not all the time. When can you use it and when can you not? Avator box setup gsm forums.

The best way for a beginner to deal with this is to use the preferred assignment operator <- and forget that equals is ever allowed. Hey, if it's good enough for Google's R style guide -- they advise not using equals to assign values to variables -- it's good enough for me.

(If this isn't a good enough explanation for you, however, and you really really want to know the ins and outs of R's 5 -- yes, count 'em, 5 -- assignment options, check out the R manual's Assignment Operators page.)

Dtsearch Software

One more note about variables: R is a case-sensitive language. So, variable x is not the same as X. That applies to pretty much everything in R; for example, the function subset() is not the same as Subset().

c is for combine (or concatenate, and sometimes convert/coerce.)

When you create an array in most programming languages, the syntax goes something like this:

myArray = array(1, 1, 2, 3, 5, 8);

Or:

Download Dtsearch Syntax Manual Free Download

int myArray = {1, 1, 2, 3, 5, 8};

Or maybe:

myArray = [1, 1, 2, 3, 5, 8]

In R, though, there's an extra piece: To put multiple values into a single variable, you need the c() function, such as:

my_vector <- c(1, 1, 2, 3, 5, 8)

If you forget that c, you'll get an error. When you're starting out in R, you'll probably see errors relating to leaving out that c() a lot. (At least I certainly did.)

Download Dtsearch Syntax Manual Free Download

And now that I've stressed the importance of that c() function, I (reluctantly) will tell you that there's a case when you can leave it out -- if you're referring to consecutive values in a range with a colon between minimum and maximum, like this:

my_vector <- (1:10)

I bring up this exception because I've run into that style quite a bit in R tutorials and texts, and it can be confusing to see the c required for some multiple values but not others. Note that it won't hurt anything to use the c with a colon-separated range, though, even if it's not required, such as:

my_vector <- c(1:10)

One more very important point about the c() function: It assumes that everything in your vector is of the same data type -- that is, all numbers or all characters. If you create a vector such as:

my_vector <- c(1, 4, 'hello', TRUE)

You will not have a vector with two integer objects, one character object and one logical object. Instead, c() will do what it can to convert them all into all the same object type, in this case all character objects. So my_vector will contain '1', '4', 'hello' and 'TRUE'. In other words, c() is also for 'convert' or 'coerce.'

To create a collection with multiple object types, you need a list, not a vector. You create a list with the list() function, not c(), such as:

My_list <- list(1,4,'hello', TRUE)

Now you've got a variable that holds the number 1, the number 4, the character object 'hello' and the logical object TRUE.

Loopless loops

Iterating through a collection of data with loops like 'for' and 'while' is a cornerstone of many programming languages. That's not the R way, though. While R does have for, while and repeat loops, you'll more likely see operations applied to a data collection using apply() functions or by using the plyr or purrr packages.

But first, some basics.

Download Dtsearch Syntax Manual Free Free

If you've got a vector of numbers such as:

my_vector <- c(7,9,23,5)

and, say, you want to multiply each by 0.01 to turn them into percentages, how would you do that? You don't need a for, foreach or while loop. Instead, you can create a new vector called my_pct_vectors like this:

my_pct_vector <- my_vector * 0.01

Performing a mathematical operation on a vector variable will automatically loop through each item in the vector.

Typically in data analysis, though, you want to apply functions to subsets of data: Finding the mean salary by job title or the standard deviation of property values by community. The apply() function group and plyr add-on package are designed for that.

There are more than half a dozen functions in the apply family, depending on what type of data object is being acted upon and what sort of data object is returned. 'These functions can sometimes be frustratingly difficult to get working exactly as you intended, especially for newcomers to R,' says a blog post at Revolution Analytics, which focuses on enterprise-class R.

Plain old apply() runs a function on either every row or every column of a 2-dimensional matrix where all columns are the same data type. For a 2-D matrix, you also need to tell the function whether you're applying by rows or by columns: Add the argument 1 to apply by row or 2 to apply by column. For example:

apply(my_matrix, 1, median)

returns the median of every row in my_matrix and

apply(my_matrix, 2, median)

Download Dtsearch Syntax Manual Free Pdf

calculates the median of every column.

Other functions in the apply() family such as lapply() or tapply() deal with different input/output data types. Australian statistical bioinformatician Neal F.W. Saunders has a nice brief introduction to apply in R in a blog post if you'd like to find out more and see some examples. (In case you're wondering, bioinformatics involves issues around storing, retrieving and organizing biological data, not just analyzing it.)

Until recently, many R users who dislike the the apply functions don't turn to for-loops, but instead install the plyr package created by Hadley Wickham. He uses what he calls the 'split-apply-combine' model of dealing with data: Split up a collection of data the way you want to operate on it, apply whatever function you want to each of your data group(s) and then combine them all back together again.

If you'd like to find out more about plyr, you can head to Wickham's plyr website. There's also a useful slide presentation on plyr in PDF format from Cosma Shalizi, an associate professor of statistics at Carnegie Mellon University, and Vincent Vu.

Now, Wickham has created a new package, purrr, for this kind of data manipulation. I find plyr somewhat easier to understand for simple tasks, but purrr to be more powerful. purrr is a bit beyond the scope of a basic beginner's guide. But if you'd like to learn more, head to the purrr website and/or consider taking Charlotte Wickham's excellent purrr tutorial from the 2017 useR! conference (video is free on Microsoft's Channel 9).

R data types in brief (very brief)

Should you learn about all of R's data types and how they behave right off the bat, as a beginner? If your goal is to be an R ninja then, yes, you've got to know the ins and outs of data types. But my assumption is that you're here to try generating quick plots and stats before diving in to create complex code.

So, to start off with the basics, here's what I'd suggest you keep in mind for now: R has multiple data types. Some of them are especially important when doing basic data work. And some functions that are quite useful for doing your basic data work require your data to be in a particular type and structure.

More specifically, R has the 'Is it an integer or character or true/false?' data type, the basic building blocks. R has several of these including integer, numeric, character and logical. Missing values are represented by NaN (if a mathematical function won't work properly) or NA (missing or unavailable).

As mentioned in the prior section, you can have a vector with multiple elements of the same type, such as:

1, 5, 7

or

'Bill', 'Bob', 'Sue'

>

A single number or character string is also a vector -- a vector of 1. When you access the value of a variable that's got just one value, such as 73 or 'Learn more about R at Computerworld.com,' you'll also see this in your console before the value:

[1]

That's telling you that your screen printout is starting at vector item number one. If you've got a vector with lots of values so the printout runs across multiple lines, each line will start with a number in brackets, telling you which vector item number that particular line is starting with. (See the screen shot, below.)

If you want to mix numbers and strings or numbers and TRUE/FALSE types, you need a list. (If you don't create a list, you may be unpleasantly surprised that your variable containing (3, 8, 'small') was turned into a vector of characters ('3', '8', 'small') ).

Download Dtsearch Syntax Manual Free

And by the way, R assumes that 3 is the same class as 3.0 -- numeric (i.e., with a decimal point). If you want the integer 3, you need to signify it as 3L or with the as.integer() function. In a situation where this matters to you, you can check what type of number you've got by using the class() function:

class(3)

class(3.0)

class(3L)

class(as.integer(3))

There are several as() functions for converting one data type to another, including as.character(), as.list() and as.data.frame().

R also has special vector and list types that are of special interest when analyzing data, such as matrices and data frames. A matrix has rows and columns; you can find a matrix dimension with dim() such as

dim(my_matrix)

A matrix needs to have all the same data type in every column, such as numbers everywhere.

Data frames are like matrices except one column can have a different data type from another column, and each column must have a name. If you've got data in a format that might work well as a database table (or well-formed spreadsheet table), it will also probably work well as an R data frame.

Download Dtsearch Syntax Manual Free Online

In a data frame, you can think of each row as similar to a database record and each column like a database field. There are lots of useful functions you can apply to data frames, some of which I've gone over in earlier sections, such as summary() and the psych package's describe().

And speaking of quirks: There are several ways to find an object's underlying data type, but not all of them return the same value. For example, class() and str() will return data.frame on a data frame object, but mode() returns the more generic list.

If you'd like to learn more details about data types in R, you can watch this video lecture by Roger Peng, associate professor of biostatistics at the Johns Hopkins Bloomberg School of Public Health: