Sensenet: Query Builder, search for fields - sensenet

I'm exploring the Query builder component of Sensenet. enter link description here
On "Query Wizard" it is possible to search by "Content Type" and "Fields" (of the Selected Content)...
Imagine that I have a Document Library, and the user customized the fields of his library (add more fields). Is it possible to search by the custom fields on the query builder? should I customize the Query builder component?

QueryBuilder has 2 tabs, one for a click-and-pick query ("Query wizard"), and one for editing the query ("Query editor"). If you know the name of the field you want to query, then the answer is "Yes". The QueryBuilder should pull all of the content and fields for your content. Also, if you have a custom Content created by defining a new Content Type then all of those fields will be exposed in the QueryBuilder.
As an example, if you were searching Documents (of type File) and the custom field name was MyCustomField and you were searching for the value foo in this field, the query in the Query editor would look something like this:
TypeIs:File AND MyCustomField:foo
You can toggle between the wizard and editor to validate the query. Please submit another SO question if you need to know how to query for the name(s) of the custom field(s).

Related

Describing a field (data dictionary not statistics)

Brand new to Splunk and curious whether there is a way to add descriptive text to the pop out window that appears when a user selects (clicks) a field in the search results? I am building a data dictionary for myself, but I would like to view these descriptions in Splunk. Is there a way to do this?
Not as such - unless you "intelligently" name the fields (or field aliases) or eventtypes, you're going to get whatever the field name is, and whatever the field's contents are

How to handle search for custom fields in form for FROM and TO fields?

I have just started implementing search module in a project, where I have a form with fixed fields consisting of combo box, text box, radio button etc (around 200 fields in multiple tabs), and later client should be able to add extra fields too. Once user fills the fields which he wants to search, that search criteria also he should be able to save. For all these reasons, for each field I am associating metadata in the following format.
"EntityName.attributeName": attributeValue
Once the user fills the form fields to search, I will validate form data and and only non empty fields metadata I am sending to server in JSON format. Everything is fine till now. But I am facing an issues now.
Using the metadata of each field I will create a new criteria for each field. but if there are fields where one field metadata depends on other field metadata I am struck.
In the form I have few special category fields in following format : for example DOB,
FROM DATE (meta data: entity1.dob)
TO DATE (meta data: entity1.dob)
both fields belongs to same entity and same column only field name in the UI is different
Like this I have around 20 fields which asks for FROM and TO to query the range (it need not be on date, for example no of bed rooms..it can be on integer, string etc)
My query formation should be in the following way depending on user search criteria. If user entered only FROM field of number of bed rooms then I have to query using EQUAL to operator in sql and if both mentioned then MORETHANEQUAL to for FROM field and LESSTHANEQUAL to for to field. So how I can handle this special case ?
like if he entered number of fields as 4 in TO field of number of bed rooms, then I have to query for houses having number of bed rooms equal to 4. but if in FROM he entered 3 and in To if he entered 7 then I have to query for houses having greater than or equal to 3 bed rooms and less than or equal to 7 bed rooms.
Since I have same metadata for these category fields also I am unable to proceed, to achieve this, what kind of metadata I need to prepare ?
How I can generalize this process to handle all the cases ?
my technology stack: ExtJs, Eclipse Link, spring.
and what are the best practices to follow to support custom fields adding feature in Forms in enterprise applications ?
Off of the top of my head, I would create wizards for these particular cases. So for example, have a custom wizard that allows the user to define a "from" field, a "to" field, and then the comparison operator in one action. This wizard could also be responsible for adding custom properties to the generated fields that could be used by your validation routine. So based on the combo of from, to, and operator, you could create a flexible validation mechanism for ensuring that correct values are entered, ranges are correct, whatever.
You might consider this "wizard" approach for all custom fields, in fact. I could see you predefining all the possible custom field types that could be used and create classes that can be used for those. The classes could be responsible not only for the field creation, but also for providing any custom validation, pre-submit transformation, etc. This approach would make adding new custom field types incredibly simple since all you'd have to do is follow the same implementation as the others that already exist, extend an existing one, etc.

How to filter a Sharepoint List Column with a Textbox Control Value using a "Contains" query?

I'm using a data view to display a list (Sharepoint 2010) that has several columns including one that has a Name column. I've provided the user with a text filter on the page to send values to filter the Name column in this list. The problem I'm facing is that the filter only works for exact matches and not partial matches.
I tried to overcome this problem by using Sharepoint Designer to:
create a parameter that uses the textbox control value.
Filtering the Name column with this parameter and setting the comparison to "Contains"
Unfortunately if the default value of the Parameter is blank, the list does not display any data. If the default value of the parameter is set to part of a name in the list, the list displays names that contain that string. However, when changing the value in the text box and searching, the list does not return results. Please let me know if you guys know how to fix this. Any help is much appreciated and let me know if you need any additional information. Thanks!
Managed to find a solution to my problem. I used a custom javascript solution designed by jvossers (http://instantlistfilter.codeplex.com) that involves the list being filtered instantly much like Google's search!
The only downside of this solution is that it only filters the items currently displayed on the screen. Therefore, if you have a data view web part which limits the amount of items displayed on the page, this solution won't help you. In order to facilitate this solution, display all the row items on the page (by increasing the item limit per page to a larger number than your total list rows) and then add this code into a content editor web part on the same page. Worked brilliantly for me. '
By the way if you are using jQuery 1.3.x or higher, you should modify the script a little as described in the disscussion here: http://instantlistfilter.codeplex.com/Thread/View.aspx?ThreadId=49123

Retrieving specific fields in a Solr query?

I am running a Solr instance on Jetty and when I search using the Solr admin panel, it returns the entire document. What should I do to get only specified fields from each Solr document returned by the search?
/?q=query&fl=field1,field2,field3
From the Solr Admin home page, click on "Full Interface". On that page there is a box called "Fields to Return". You can list the you want here (comma-separated). "*" means all fields.
http://xx.xxx.xx.xx:8983/solr/corename/select?indent=on&q=*:*&wt=json&fl=ImageID,Imagepath,Category
This link has fl parameter:
fl is a field list, which will display the specified fields from the indexed list.
The best way is to run the query from Admin concole. When we run it, it also provides the actuall SQL query executed. Just copy the query and use it.
About the question: select specific fields from the table. In the admin console look for 'FL' text box. write the field names you want to retrieve, comma sapereted. Hit the 'Execute Query' button.
Top right side the SQL will be available.
Generated Query: ......select?fl=FIELDNAME&indent=on&q=:&wt=json
you can simply pass fl parameter with required fields name in your query.
&fl=field1,field2,field3&query=:
your response documents contains only mentioned fields.

How do I show data in the header of a SQL 2005 Reporting Services report?

Out of the box SSRS reports cannot have data exposed in the page header. Is there a way to get this data to show?
One of the things I want in my reports is to have nice headers for my reports. I like to have a logo and the user's report parameters along with other data to show to give more information for the business needs the report needs to clarify. One of the things that Microsoft SQL Server 2005 Reporting Services cannot do natively is show data from a Dataset in the header. This post will explain how to work around this and how easy it is.
Create the Report Server Project in the Business Intelligence Projects section and call it AdventureWorksLTReports. I use the AdventureWorksLT sample database from CodePlex.
alt text http://www.cloudsocket.com/images/image-thumb.png
Next show the Page Header by right clicking in the Report area with the designer.
alt text http://www.cloudsocket.com/images/image-thumb1.png
The Page Header will appear. If you want to show the Page Footer this can be accessed from the same menu as the Page Header.
alt text http://www.cloudsocket.com/images/image-thumb2.png
I created a stored procedure that returns data for the Sales Order to be presented in the Page Header. I will show the following information about the Sales Order in the Page Header:
Order Date
Sales Order Number
Company
Sales Person
Total Due
I create a TextBox for each of my data fields in the Page Header along with a TextBox for the corresponding label. Do not change the Expression in the TextBoxes that you want the Sales Order data in.
alt text http://www.cloudsocket.com/images/image-thumb3.png
In the Report Body, place a TextBox for each data field needed in the Page Header. In the Visibility for each TextBox, select True for Hidden. This will be the placeholder for the data needed in the Page Header.
alt text http://www.cloudsocket.com/images/image-thumb4.png
Your report should look similar to the screenshot shown below.
alt text http://www.cloudsocket.com/images/image-thumb5.png
The last step and most important is to reference the Hidden TextBox in the TextBoxes located in the Page Header. We use the the following Expression to reference the needed TextBoxes:
=ReportItems!.Value
Your report should now look similar to the following:
alt text http://www.cloudsocket.com/images/image-thumb6.png
Your Report preview should now have the Sales Order Header data in the Report Header.
alt text http://www.cloudsocket.com/images/image-thumb7.png
You have to do it through Parameters. Add a parameter for each piece of data you would like to display, then set the parameter to Hidden. Then set the default value to "From Query" and set the Dataset and Value field to the appropriate values.
I think the best option is creating a internal parameter, with the default value the field of the dataset you want to show.
Here are two possible workarounds:
You can place the databound field within the body of the report as a hidden textbox, and then in the header place another textbox with it's value pointed at the the one hidden within the body.
Try using report parameters to store the data, and use those parameters to access the data in the header.
This technique wouldn't work if your report spans over multiple pages, use queried parameters instead, and set the textbox value to =Parameters!Name.Value as per this article.
I'm with Orion Adrian here. Report parameters are the way to go.
I wanted to show a field, common to all returned rows, in the header, and for this scenario I went for the linked table solution (placing a table containing the field in the body and link a textbox in the header to this table).
I did that because if you are using the parameter solution and no data is returned to the field in question, the text "Parameter is missing a value" is shown instead of just a blank table. I reckoned this text would confuse users (as the parameter isn't even visible).