Filters in Lucene - lucene

Friends,
I am new to lucene full text search. i have developed page with full text seach. it works fine till. but now i want to add extra condition like where clause. how to do it.
The requirement given for me is, i have to list proposal which is created by logged in user. I have to add this condition in back end without user knowledge.
I heard about filter. Which filter is correct?how to apply that.Give me an sample. this evening i have demo. help me.

First, you need to ensure that the user id is being added to the document in the index in a field when you index, let's call it user_id.
In a pinch, you can add a field to the query string entered by the user behind the scenes before you send it to the query parser. So, take whatever query was entered and add " AND user_id:4" (where 4 is the value of the variable containing the current user id) onto the end of it.

Related

My recordset returns only one record even though there are more one record in Microsoft Access

I am creating a form that loads all the information from the Activity_Table into the form. So basically when the user chooses the name of the Company from the Company_Name drop down, and selects the site from the Site_Name combo box, it is supposed to return the values from that site and put them into the form.
Basically one site can appear more than once in the Activity_Table. Yet, whenever the user selects the name of the site, it only returns one record. To make sure of this, I used the .Recordcount method to check how many records that will be retrieved.
So when you check the Activity table, the Site "Accra Mall - 630kva Gen 2 " appears 4 times, yet when you check the recordcount, it only says it appears Once. So because of this, I cannot move either forward or backwards to either the next or previous record.
To make sure that there was nothing wrong with my sql, I run the query in the Query Design and it produced all 4 records of "Accra Mall - 630kva Gen 2".
So there is nothing wrong with the sql statement. Can anyone help me out please?
This is when I choose the name of the site
We can see that it returns only One record here
Yet this is the amount of records it's supposed to produce(This was when I tried the sql code in the query design tab. It returns 4 records, Not 1). So the recordcount is supposed to be 4. Not One.
this is when I tried the sql to in the previous picture.
If I replicated your problem correctly then the answer is to set Data-Entry to no. Check your form properties. Under the data tab there is a data-entry property. set data-entry to no. From microsoft at https://support.microsoft.com/en-us/office/dataentry-property-f4236759-27f6-4fcd-abb0-4aa4acd8fe87 we get an explanation:
You can use the DataEntry property to specify whether a bound form opens to allow data entry only. The Data Entry property doesn't determine whether records can be added; it only determines whether existing records are displayed. Read/write Boolean.

Custom Code to repeat static row on a new group instance only

I have a report where the end user has an input section strictly for in person use. It is a row where they choose "yes" or "no", basically. The issue is that this section is based per group. So, for example, each group is a sales order, that order may have many pages, this "yes/no" section requirement is to only show on the first page of each group.
Note, I have tried to used the Previous function to hide the row, using a field a field from the header section, no luck there. I'm not a programmer by trade and more over don't have experience in VBA
I have exhausted my searches on Google and it doesn't seem like anyone has done this before. It may not be possible because in the row the fields are static texts and aren't referenced from a real dataset.
Appreciate any input or work around that could work, or solidify the fact this isn't possible in SSRS

Avoid to list all records on empty search in YII Admin page

In YII admin page (CRUD), by default all the records of the table will be displayed when searching with empty data in all fields.
But i need to avoid the default list. Instead, some data need to be entered in filter text box. Then only search result should shows the result based on the input. Otherwise no record should displayed.
Thanks in advance.
In the search function for your model replace the $criteria->compare(.... with CDbCriteria methods that add the same condition. The compare method is the only one that doesn't add a condition expression to the criteria if the attribute is empty.

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

InfoPath 2010 NaN

I have been trying to update a text field in a form that will automatically generate a new number in a read only state when a user fills out the form. When the user completes the form and selects the submit button, the form will be attached to SharePoint List and the following user will open the form and the number field will be the number +1. I have used 'count(mynumber)' and the field returns 1, but when I close the form and re-open it, the field still displays 1 and never increases. When I use 'count(mynumber) + 1' the field returns 2 and also never updates. Finally, I used 'max(mynumber) +1' and it returns NaN. I have come to the conclusion that there is an array here, but don't know what I need to do, to fix this.
I have informed my manager of 'InfoPath 2010 Cookbook' so hopefully this will help, but I also took a gander as this following link, which was not easy to follow as I believe its for 2007 instead of 2010.
http://claytoncobb.wordpress.com/2009/06/15/auto-numbering-infopath-forms/
I am using SP 2010.
So, here is the simple approach to the simple request:
•Just like in any database, every item in every list and library in SharePoint has a unique ID. This ID is stored in the ID field, which is available for viewing in any list or library. Go to your list, modify the view, and check the box next to the ID field so you can see what I mean. This ID is 100% guaranteed to be unique and is never duplicated.
•Since you already have purchase order numbers, you can't use the IDs by themselves, however, you can use them to drive your auto-generated Service Order numbers
•The easy method for doing this is to utilize your SO field, which is now a Number field, and determine the differential between the next ID in the list and the next Service Order number that needs to be created.
•Then, create a simple workflow in SharePoint Designer 2010 that ONLY runs on the creation of a new item (only runs once per item/form), and set it to add the differential to the current item's ID (Something like Do Calculation: ID + 1200) . Next, use Set Field in Current Item to set your SO field to the variable created by the Do Calculation step
From then on, you will always have a GUARANTEED unique, auto-incremented SO # for each form, and you should make this field read-only inside the form so that users can only view it and not edit it.
--Clayton Cobb