Sphins Regexp maps to only single words - sphinx

I am trying to map regexp so when a user enters a specific word I force them to choose a specific other term in the table.
For instance I have as simple example fields:
Bob
Bob Smith
Bob Jones
Sally
Sally Smith
Sally Jones
If I do
regexp_filter=Bob>Bob Smith to make sure when a user simply enters Bob I push Bob Smith instead and then do a sphinql search:
Select * from Index where MATCH('Bob')
I still get all the Bob records (in other words it did not interpret as Bob Smith
However if I dod
regexp_filter=Bob=>Sally
Then Select * from Index where MATCH('Bob') returns all the Sally records.
I am "simply" trying to force the index to return the Bob Jones record should a user simply search on Bob.
FYI I did try
Select * from Index where MATCH('^Bob$')
and that returned NULL

I still get all the Bob records (in other words it did not interpret as Bob Smith
Because the regex is applied to BOTH the query text and document text during indexing. So becomes MATCH('Bob Smith'), but your documents also become
Bob Smith
Bob Smith Smith
Bob Smith Jones
... so your query, matches all three documents, same if didnt have the regex!
I am "simply" trying to force the index to return the Bob Jones record should a user simply search on Bob.
Wonder if you meaning should NOT return ?
... in which case can use MATCH('^Bob$') but rememeber to remove the regex. Or could perhaps use MATCH('"^Bob$"') an extra set of quotes to use phrase mode.
Try also MATCH('^Bob$ ') with a space! some versions of sphinx has a bug unless a space after the $!

Related

PostgreSQL update column based on the same column

I would like to update a column in a table that contains names with several characters added as suffix. Is it possible to remove these characters from this specific column in some way as there is not any other condition?
For example I have got names such as
Joe Doe Nm and I want to update it to Joe Doe
John Crow Nkk and update it to John Crow
George Stavrou_Ngf and same as above (George Stavrou)
and similar style regarding names.
Regards

Tableau Calculation with a Filter in place

I'm trying to get the count of calls received by an individuals, both initial answer and any possible transferred over by another person.
My workbook has a filter based on the individual who first answers the phone. Now I need to add in any calls that were transferred over. These calls are usually answered by another individual.
This is what I would like to see
John: #calls =3 | #calls Transferred to =1
Where the data would show this:
Incoming | Transferred to
John | James
John | NUll
John | NUll
James | John
Does anybody have a way to get in the last call to be attribute it to John with the filter in place?
My filter of John would give me the three calls, but would remove the transferred call.
Try creating two calculated fields using the following formulas and then use them as filters.
Filter - John
if contains([Incoming], "John") then "John"
ELSEif
CONTAINS([Transferred to], "John") then "John"
END
Filter - James
if contains([Incoming], "James") then "James"
ELSEif
CONTAINS([Transferred to], "James") then "James"
END

Count Number of Rows with Condition

I have a document names.csv with two columns. I want to count the number of rows that have the same values and modify the document to display the count using Powershell. For example:
Joe Florida
Joe California
Joe Florida
Bob Texas
Joe Texas
Joe Florida
Joe Florida
Bob Minnesota
Joe California
I want the output to be:
Bob Minnesota 1
Bob Texas 1
Joe California 2
Joe Florida 4
Joe Texas 1
This needs to be generic because column 1 will contain an arbitrary number of names. I really do not know where to begin. Please only answer with full names (do not say gc for Get-Content).
You can use the Group-Object cmdlet here like below.
If csv is like below
Name,Place
Joe,Florida
Joe,California
Joe,Florida,
Bob,Texas
Joe,Texas
Joe,Florida
Joe,Florida
Bob,Minnesota
Joe,California
Import-Csv -Path C:\Temp\Temp.csv | Group-Object -Property Name,Place
You can put your own logic to write it to new csv.

Crystal Reports Rows in Group

I have a report grouped by Supplier. In the details section for this group, there are customer names with other fields of information. The problem is that a customer may be listed several times, but I only want one record to show per customer.
Supplier
John Doe 10/15 $25.00 Eggs
John Doe 10/15 $29.00 Milk
Susan Weva 10/12 $15.00 Corn
Susan Weva 10/18 $11.00 Bread
What I want is one complete row for John Doe and one for Susan Weva. Any idea as to how I can do this? I tried to suppress each field, but that did not seem to work.
There is one way (which i use in this situations) and it work.
So your data looks like this
John Doe 10/15 $25.00 Eggs
John Doe 10/15 $29.00 Milk
Susan Weva 10/12 $15.00 Corn
Susan Weva 10/18 $11.00 Bread
From what i have understand you want to have your output like
John Doe some columns
Susan Weva some columns
To show it only once per group put fields in group header or group footer. In your case all other columns are different and you should "summarize" those fields. For field price is easy, just do summarize by group and you have for each person amount. But dates and last columns makes a problem. So you should learn about using Cross-tab to solve this problem. If you need only sum of price, then put fields in group header or group footer and it will be show only once per group.
Hope it helps

Word Master-Detail Mail Merge

I searched a lot to find out how to do a "master-detail" style mail merge in word but i couldn't find an appropriate answer/tutorial.
my data look like this:
id name property
-----------------------------
1 John Doe employed
1 John Doe married
1 John Doe male
2 Don Joe employed
2 Don Joe single
2 Don Joe male
and the result should look like this:
with a page-break between every key record.
Does anyone know how this can be achieved through a Microsoft Word Mail Merge?
(i know SSRS,etc.. are better tools for this, but i have to use MS Word because on the client this is the only thing that's possible)
Yes - this is possible using WORDs mail merge.
I don't think you can do it with your data the way it is now. There's not much that can be done to manipulate the data before it gets to the mail merge.
You would need to clean up the data to combine the properties for each person into one field before you can do the merge.
Is your data in Excel? You can write some VBA to combine the properties field.
If it's in a database, you can use SQL to combine the fields using For XML Path.
Once your data is cleaned up, you would be able to use the Mail Merge Wizard.
For the Doc Type, select Letter and use a blank page (current document).
Then select your data.
The next step is to Write Your Letter. Type your field name (i.e. **Name: **) and click on the Insert Merge Field and select the field to insert.
Repeat for all you fields.