|
Hi all!
I am indexing Russian text with that code. I have a problem, when I try to search for words in different cases.
Search is productive, only if the word is in the same form, as in the initial (indexing) text. Help me please.
(Whether there can be it because Words in RussianStemmer.cs are stored in the coding KOI8-r?)
versions: Lucene.Net 2.0.0.4, Snowball.Net 2.0.0.1
using System;
using System.Collections.Generic;
using System.Text;
using Lucene.Net.Documents;
using Lucene.Net.Index;
using Lucene.Net.Analysis.Snowball;
using Lucene.Net.Search;
using Lucene.Net.QueryParsers;
using System.Text.RegularExpressions;
using Lucene.Net.Analysis;
class Program
{
static void Main(string[] args)
{
string index_path = @"D:\index\";
System.IO.StreamReader reader;
reader = new System.IO.StreamReader(new System.IO.FileStream(@"d:\source\67165.html", System.IO.FileMode.Open, System.IO.FileAccess.Read), System.Text.Encoding.Default);
reader = new System.IO.StreamReader(reader.BaseStream, reader.CurrentEncoding);
String title = Regex.Replace(reader.ReadLine(), "<[^>]*>", "");
String fullText = Regex.Replace(reader.ReadToEnd(), "<[^>]*>", "");
Document doc = new Document();
doc.Add(new Field("message_title", title, Field.Store.YES, Field.Index.TOKENIZED));
doc.Add(new Field("message_text", fullText, Field.Store.NO, Field.Index.TOKENIZED));
Analyzer a = new SnowballAnalyzer("Russian");
bool create_key = true;
IndexWriter iw = new IndexWriter(index_path, a, create_key);
iw.AddDocument(doc);
iw.Optimize();
iw.Close();
String query_string = "??????";
Search(query_string, index_path);
query_string = "??????";
Search(query_string, index_path);
query_string = "???????";
Search(query_string, index_path);
query_string = "????????";
Search(query_string, index_path);
Console.ReadKey();
}
static void Search(string query_string, string index_path)
{
Searcher search = new IndexSearcher(index_path);
Analyzer a = new SnowballAnalyzer("Russian");
QueryParser parser = new QueryParser("message_text", a);
Query q = parser.Parse(query_string);
Hits hits = search.Search(q);
string[] result = new string[0];
if (hits.Length() > 0)
{
result = new string[hits.Length()];
for (int i = 0; i < hits.Length(); i++)
{
result[i] = hits.Doc(i).GetField("message_title").StringValue();
Console.WriteLine("\n{0}. {1}\n", i + 1, result[i]);
}
}
else
{
Console.WriteLine("\n Missing Search!!!\n");
}
}
}
Russian text example (for indexing):
"?????? ???????? ? ?????? ????????? ??????? ?????????
radiomayak.ru
?? ? ??????. ??????? ?????? ??????? ?????? ????????. ???? ???????, ???? ?????????. ?? ???? "?????" ?? ???????? ??????? ??????????? ????????????? ????????????? ??? ??????? ??????.
??????: 25 ????? ?????? ???????? ?? ?????? ??????? - ??? ?????? ?????? ?????? ? ?????? ?????????????, ??????????? ?????? ???????, ?????? ??? ?????? ?? ???????? ??????? ? ???????? ??????? ????.
? 11:40 ?? ?????? ????????? ????????? ?????????? ? ???, ??? ???????????? ? ???? ???????? ???? ????????? ??-??? ?????. ?????? ????????? ??????? ?????????. ? 12:30 ?? ?????? ??????? ???????????? ????? ?????? ?????????? ??? ????????? ???????????? ?????? ????????."
forum
|
|
|
|
|
I need best date picker tool for my web application to check in and check out the dates. i searched a lot in google but i cant find till now...
Note: the check out date should change dynamically as per the check in date... Please help me...
Gopinath.R
|
|
|
|
|
Hi ,
I don't know whether it will fulfill your requirement or not, but this is good calendar. And it is in javascript.
Here[^]
Regards
|
|
|
|
|
AJAX toolkit has a calendar extension. You can use that.
|
|
|
|
|
you can create your own control with your specific functionality by extending the AJAX toolkit calendar control...
it is bit easy even for a newbee...
you can even put the checkpoints on date_change event to check for the start date and validating the end date or restricting the selection criteria of end date...
ask help if needed...
cheers !
Ashish Sehajpal
|
|
|
|
|
am using the excel 2000.
In c# , i am writing the following code.
Excel.Application xls = new Application();
xls.Workbooks.Open(path);
But the second code line is giving error
No overload for method 'Open' takes '1' arguments
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=796937&SiteID=1
I visited the site
The site also mentioned one parameter ,
Please help.
If you have an apple & I have an apple and we exchange our apples, then each of us will still have only one apple but if you have an idea & I have an idea and we exchange our ideas, then each of us will have two ideas!
|
|
|
|
|
hai frnds
i m developing a web portal in asp.net 2.0
in a page i set the property "AutoPostBack=True" for so many controls
say 8 controls i set that property
is there any disadvantage for this property...
i mean that so many times , the page is post back to it self..
is there any problem with it...
what happens when a page is post back to itself so many times ...
plz sen reply ....
thanks in advance
vijay
devulapally_vijay@yahoo.co.in
|
|
|
|
|
vijaylumar wrote: is there any disadvantage for this property...
nothing. Each time your server will get a hit and it has to do the processing, also user has to wait till the page posts back.
|
|
|
|
|
navneeth is right..
this is total wastage fo resources if unnecessary post backs are there... try to minimize the post backs and even the use of RUNAT="SERVER" controls wherever possible..
try to use simple HTML labels instead of asp:labels. it reduces server traffic and round trips and increases user acceptance to a very high level.
cheers...!
Ashish Sehajpal
|
|
|
|
|
How can i run the downloded Custom control Projects downloded from this site, other than the instruction given in the zip?
Is there any possiblity to get exe files for the projects
modified on Saturday, April 5, 2008 1:04 AM
|
|
|
|
|
You need to ask this on the article's discussion board from where you downloaded the zip file.
|
|
|
|
|
Hi all,
I have a page to remove Items from a database, the page layout is as follows:
---------------------------------
Item1 Description [Remove Button]
---------------------------------
---------------------------------
Item2 Description [Remove Button]
---------------------------------
.
.
---------------------------------
ItemN Description [Remove Button]
---------------------------------
Now, when I click on the remove button the item is removed from the database but when the page is submitted and reloaded, the removed item stays in the page contents (despite it was removed from the database) until you REFRESH the page. It seems that the browser reloads the page from the cache but I don't want this to happen, I want the changes to be reflected instantly.
BTW: the Item description and the remove button are wrapped in a web user control, I hope that this does not complicate the solution
Thanks
Mohammad Gdeisat
And ever has it been that love knows not its own depth until the hour of separation
|
|
|
|
|
just try:-
1. disable the response cachebility
Response.Cache.SetCacheability(HttpCacheability.NoCache)
2. bind the grid again on update command
may be helpful for you....
Ashish Sehajpal
|
|
|
|
|
I am trying to databind an image to a repeater control. The problem is when i execute the procedure the image isn't appearing. Below is the code for both page and behind:
<asp:Repeater ID="rpt_content" Runat="server">
<ItemTemplate>
<h2><%#DataBinder.Eval(Container.DataItem, "Article_Title")%></h2>
<asp:Image ID="img_article" runat="server" ImageUrl='<%#DataBinder.Eval(Container.DataItem, "Article_Image")%>' />
<%#DataBinder.Eval(Container.DataItem, "Article_Content")%>
<%#DataBinder.Eval(Container.DataItem, "Article_Image")%>
</ItemTemplate>
</asp:Repeater>
Private Sub Repeater_Content()
Dim Select_Content As New SqlCommand("Select_Content", conn)
Dim da As New SqlDataAdapter(Select_Content)
Dim dt As New DataTable
conn.Open()
Try
Select_Content.CommandType = CommandType.StoredProcedure
Select_Content.ExecuteNonQuery.ToString()
da.Fill(dt)
Catch ex As Exception
Finally
conn.Close()
End Try
rpt_content.DataSource = dt
rpt_content.DataBind()
End Sub
|
|
|
|
|
hey mc....
use html image object instead..... it is more functional in real life...
<img src='<%# Eval("Article_Image") >' alt='' />
cheers !
Ashish Sehajpal
|
|
|
|
|
Hi, i'm creating a TextBox dynamically with the firing of a Button
but every time the page posts back the previous TextBox disappears. Is there
a way to retain that control and add the new ones below it?
Your help is greatly appreciated!
Fivos
|
|
|
|
|
hi phivos,
the concept here is that the server recognizes the controls that are present in the design view of the page... and produces the HTML code for those.
the control you created is dynamic and will be maintained only if their is some logic to add that control every time. we can a collection object declared and add a key value pair for that control i.e. "textbox1" , "value in textbox entered by user"
and add it to that collection and keep that collection object in viewstate. everytime in page load, check for number of key-value pairs in that object and run a loop to add that much controls with id as key and TEXT as value for that key...
simple solution
cheers..!
Ashish Sehajpal
|
|
|
|
|
|
if you are adding control(s) dynamically on the page, you will loos all the added controls on postback.
To avoid this...you need to understand the fundamental of aspx.
on the postback page is loosing all the dynamically added controls. Basically all the controls are available on the page, but page can not retrive them from viewstate.
You need to make rememebr the ids of dynamica added controls to the page.
ie. if you are added 2 textboxes on the page and giving ids like txt.ID="txt" +1 and for second txt.ID="txt" +2. so on the page load write the code to add the two textboxes and assign the same ids, so, page autometically will retain the text entered in the textbox on the postback.
Enjoy
|
|
|
|
|
Guru's
I have finally learned how to program Windows Services and they have been going fairly well. I even was able to create a windows app that checked the status every minute of the 2 services I created.
Now my issue: I used a ServiceController component to expose the methods to display the Status of the services and to start the service. I wanted to create a web form that could do the same but the ServiceController is grayed out when I try to use it on the Web Form. Is there anyway that I could achieve the same goal in a webform as I did with the Windows form?
Looking forward to all responses.
|
|
|
|
|
|
Hi, I have been trying to get this to work for a few days and tried searching everywhere but can't seem to find anything about this.
I am trying to login and make a post to a site. I have no problem logging into the site, however, when I go to make a post, nothing happens. After using Fiddler and comparing the results of the webbrowser and httprequest it looks like the boundary changes at each login.
For instance it will be this one time:
Content-Type: multipart/form-data; boundary=---------------------------7d829cb4c0502
and then it will be something like this (just slightly different) the next time:
Content-Type: multipart/form-data; boundary=---------------------------7d82b824c0502
I am trying to figure out how to get this information from the headers. Here is part of my code
<code>
httpWebRequest myRequest =(HttpWebRequest)WebRequest.Create(urlUri);
myRequest.CookieContainer = cookies;
myRequest.Method = "POST";
myRequest.AllowWriteStreamBuffering = true;
myRequest.UserAgent = "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 2.0.50727)";
myRequest.Referer = "urlReferer";
myRequest.Accept = "image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-ms-application, application/vnd.ms-xpsdocument, application/xaml+xml, application/x-ms-xbap, application/x-shockwave-flash, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, application/x-silverlight, */*";
Stream newStream = myRequest.GetRequestStream();
newStream.Write(buffer,0,buffer.Length);
newStream.Close();
HttpWebResponse myHttpWebResponse = (HttpWebResponse)myRequest.GetResponse();
HttpWebResponse resp = (HttpWebResponse)myRequest.GetResponse();
string[] names = resp.Headers.AllKeys;
string headerInfo = "";
Console.WriteLine("{0,-20}{1}\n", "Name", "Value");
foreach (string n in names)
headerInfo = headerInfo + <br /> + n + ": " + resp.Headers[n]; // Get the headers
resp.Close();
return headerInfo;
</code>
but this always returns
Content-Type: text/html
for the header instead of
Content-Type: multipart/form-data with the form boundary after it.
Is there anyway I can get the header information? I know it has to be possible.
Thanks
|
|
|
|
|
I'm not sure what you are trying to do. Is you problem in processing the response from the server? What do you get when you process the response stream? HttpWebResponse.GetResponseStream()
led mike
|
|
|
|
|
Thanks for the reply. I was having problems getting the boundary but think I got it figured out by using httpcontext to send the form data.
|
|
|
|
|
I have added a CheckBox to the EditItemTemplate and ItemTemplate in a GridView TemplateField. The checkbox does not show up in the ItemTemplate unless I set Enabled to true, but when I do this the checkbox is clickable. I would like to have a greyed out, readonly, checkbox in the ItemTemplate, so the user does not try to check or uncheck it, but can see its state. Is there a way to make a readonly, greyed out, checkbox in the ItemTemplate?
Thanks!
|
|
|
|