SQL - Searching for a string in database minus a section of it - sql

I'm searching a database for those that have accessed certain websites, but want to remove part of the url as the numbers within it are not static.
For instance if this "http://m.mlb.com/news/article/215311692/red-sox-send-off-equipment-on-truck-day/" was the url I want to remove the "215311692" so that i get all mlb.com results with that specific title.
Typically I use this code "ilike '%'||SUBSTRING(page_url, E'(([a-z0-9-]+\.){1,2}[a-z]{2,4})')||'%'" on the join. What do I need to add or change in order to remove the numbers in the the url in my search?

Related

Create multi-page document from a single page template using doc4j

I am planning to use doc4j for search and replace in a template. I'do like to create the page for each member in the list. Basically, I need to replicate the same page from the template. I have done simple search and replace. However, this little complex one for which I need some sample examples. Here is my requirement:
I have a docx template which has the content with place holders.
There is a table with 3 columns in it and I need to replace with different values for each column like first name, last name and etc. The number of rows may vary anywhere from one to 200. So technically this may go beyond one page. If it exceeds more than one page, then I need the table header to repeat in the next page too.
I want to copy the same template on every page and replace the place holder. Basically create a single document with multiple pages each page for one member.
Please provide me with the example.
Appreciate the help.
Thanks.

Multiple URL Queries including Text Fields and Dropdown List

I have to perform a search based on 3 queries in a single URL and so far i have achieved this
...Search.aspx?StartDate=1/9/2015&EndDate=1/9/2015
the third query which i want to include in the above URL is related to a Drop-Down List containing 100 plus options.
code
How should i write the URL to get the required option.
Why can't you do something like Search.aspx?StartDate=xx&StopDate=YY&options=selected1,selected2,selected3 ?

Restrict column name changes/creation to not allow specific characters

Currently certain characters used in column names will break external programs, so I'm looking for a way to restrict specific characters ("." "_" etc) from being used, either with the creation of new columns, or editing existing ones.
For example, if a user tried to create the column "Random_Info", it would automatically rename it to "RandomInfo", and the same goes for editing an existing column: remove the offending characters before the change is made.
The issue with this is that it might create duplicate columns, I'm not sure what the best course of action is to handle that though.
It seems like Triggers might be what I need, but I've only got them working for editing the actual content of the columns, not a change to the column name itself.
A bit stuck on this one and google has failed me, hopefully I've provided enough information for someone to give an answer here!

How to avoid retrieve entire stored field from solr

I'm using sunspot and solr for a rails app to search ebook contens, for highlight feature I have to set the ebook_content as a stored filed, every time I queried solr for result, it sends back the entire document content about the book, which makes the query very slow.
How could I only get the result without the stored field?
The fl parameter of Solr allows you to specify which fields you want returned in the result. If you had fields id, title, ebook_content, then you could use fl=id,title to omit the ebook_content field. I don't think there's support in Solr for getting all fields except one (e.g. -ebook_content).
Update
If you don't want to return the field in the normal results, but still want highlighting on that field, exclude the field as I described above, then turn on the highlighter:
hl=true
set the field(s) which should be highlighted:
hl.fl=ebook_content
and set the size of the highlighting fragment (in characters):
hl.fragsize=50
your finished query looks something like this:
?q=search term&fl=id,title&hl=true&hl.fl=ebook_content&hl.fragsize=50

Filters in 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.